我试图用gnuplot来绘制一个图形。我有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行:undefined variable:plot
是否可以绘制来自不同文件的输入数据在同一个图表中?
发布于 2018-05-04 13:43:31
改变:
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"
发布于 2018-05-04 14:52:47
例如:
filenames = "first second third fourth fifth"
plot for [file in filenames] file."dat" using 1:2 with lines
和
filename(n) = sprintf("file_%d", n)
plot for [i=1:10] filename(i) using 1:2 with lines
https://stackoverflow.com/questions/-100004026
复制相似问题