gnuplot:在单个图中绘制来自多个输入文件的数据 [英] gnuplot : plotting data from multiple input files in a single graph
问题描述
我正在尝试使用gnuplot绘制图形.我有六个文本文件.每个文本文件包含两列.第一列表示以秒为单位的时间(浮点数).第二个是序列号.我想在所有六个文件的单个图形中绘制时间与序列号的图形.我正在使用此文件来做到这一点.
I am trying to plot a graph using gnuplot. I have six text files. Each text file contains two columns. The first column represents time in seconds (a floating point number). The second one is a sequence number. I want to plot the graph of time vs. sequence number in a single graph for all six files. I am using this file to do that.
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
print_1012720
print_1058167
print_193548
print_401125
print_401275
print_401276
它给出了一个奇怪的错误,如下所示:
It is giving a strange error as below:
"plot.plt",第24行:未定义的变量:plot
"plot.plt", line 24: undefined variable: plot
我做错什么了吗?可以在同一图中绘制来自不同文件的输入数据吗?
Am I doing something wrong? Is it possible to plot the input data from different files in the same graph?
推荐答案
您是如此亲密!
更改
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"
由于gnuplot试图将单词"plot"解释为要打印的文件名而出现错误,但是您尚未将任何字符串分配给名为"plot"的变量(这很好-太令人困惑了).
The error arises 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).
这篇关于gnuplot:在单个图中绘制来自多个输入文件的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!