반응형
gnuplot : 여러 입력 파일의 데이터를 단일 그래프로 플로팅
I am trying to plot a graph using gnuplot. I have 6 text files. 각 텍스트 파일에는 두 개의 열이 있습니다. 첫 번째 열은 시간을 초 단위로 나타냅니다 (부동 소수점 숫자). 두 번째는 시퀀스 번호입니다. 6 개 파일 모두에 대한 단일 그래프의 시간 대 시퀀스 번호 그래프.이 파일을 사용하여 수행하고 있습니다.
set terminal png
set output 'akamai.png'
set xdata time
set timefmt "%S"
set xlabel "time"
set autoscale
set ylabel "highest seq number"
set format y "%s"
set title "seq number over time"
set key reverse Left outside
set grid
set style data linespoints
plot "print_1012720" using 1:2 title "Flow 1", \
plot "print_1058167" using 1:2 title "Flow 2", \
plot "print_193548" using 1:2 title "Flow 3", \
plot "print_401125" using 1:2 title "Flow 4", \
plot "print_401275" using 1:2 title "Flow 5", \
plot "print_401276" using 1:2 title "Flow 6"
내 파일 위치 :
print_1012720
print_1058167
print_193548
print_401125
print_401275
print_401276
아래와 같이 이상한 오류가 발생합니다.
"plot.plt", 24 행 : 정의되지 않은 변수 : 플롯
내가 뭔가 잘못하고 있습니까? 동일한 그래프에서 다른 파일의 입력 데이터를 그릴 수 있습니까?
너무 가까워요!
변화:
plot "print_1012720" using 1:2 title "Flow 1", \
plot "print_1058167" using 1:2 title "Flow 2", \
plot "print_193548" using 1:2 title "Flow 3", \
plot "print_401125" using 1:2 title "Flow 4", \
plot "print_401275" using 1:2 title "Flow 5", \
plot "print_401276" using 1:2 title "Flow 6"
에:
plot "print_1012720" using 1:2 title "Flow 1", \
"print_1058167" using 1:2 title "Flow 2", \
"print_193548" using 1:2 title "Flow 3", \
"print_401125" using 1:2 title "Flow 4", \
"print_401275" using 1:2 title "Flow 5", \
"print_401276" using 1:2 title "Flow 6"
The error is because gnuplot is trying to interpret the word "plot" as the filename to plot, but you haven't assigned any strings to a variable named "plot" (which is good -- That would be super confusing).
You may find that gnuplot's for loops are useful in this case, if you adjust your filenames or graph titles appropriately.
e.g.
filenames = "first second third fourth fifth"
plot for [file in filenames] file."dat" using 1:2 with lines
and
filename(n) = sprintf("file_%d", n)
plot for [i=1:10] filename(i) using 1:2 with lines
replot is another way to get multiple plots at once:
plot file1.data
replot file2.data
반응형
'development' 카테고리의 다른 글
Android의 새로운 Google 로그인 (0) | 2020.10.11 |
---|---|
dataTable에 값이 있는지 확인 하시겠습니까? (0) | 2020.10.11 |
예외 또는 반환 코드를 선호하는 이유는 무엇입니까? (0) | 2020.10.11 |
콘텐츠 파일을 asp.net 프로젝트 파일에 자동으로 포함하는 방법이 있습니까? (0) | 2020.10.11 |
텍스트 상자가 비활성화되어 있는지 또는 jquery를 사용하지 않는지 찾기 (0) | 2020.10.11 |