首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >gnuplot:在单个图中绘制多个输入文件的数据?

gnuplot:在单个图中绘制多个输入文件的数据?
EN

Stack Overflow用户
提问于 2018-05-04 05:04:49
回答 2查看 0关注 0票数 0

我试图用gnuplot来绘制一个图形。我有6个文本文件。每个文本文件包含两列。第一列表示时间(秒)(它是一个浮点数)。第二个是序列号。我想绘制所有六个文件在单个图中的时间与序列号的关系图。我正在使用此文件来完成此操作。

代码语言:javascript
复制
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

是否可以绘制来自不同文件的输入数据在同一个图表中?

EN

回答 2

Stack Overflow用户

发布于 2018-05-04 13:43:31

改变:

代码语言:txt
复制
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"

到:

代码语言:txt
复制
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"
票数 0
EN

Stack Overflow用户

发布于 2018-05-04 14:52:47

例如:

代码语言:txt
复制
filenames = "first second third fourth fifth"
plot for [file in filenames] file."dat" using 1:2 with lines

代码语言:txt
复制
filename(n) = sprintf("file_%d", n)
plot for [i=1:10] filename(i) using 1:2 with lines
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/-100004026

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档