gnuplot从给定的数据点绘制错误的图形
我有一个包含一些数据点的文件:
# energytime.dat
# X Y
64.934 1993
64.9264 0.0029
64.9022 1897
64.9296 1877
64.8698 1885
64.953 3799
我编写了以下脚本来绘制图形:
#!/usr/bin/gnuplot -persist
set title "Energy vs. Time for all algorithms"
set xlabel "Energy"
set ylabel "Time"
set style line 1 \
linecolor rgb '#0060ad' \
linetype 1 linewidth 2 \
pointtype 7 pointsize 1.5
plot "energytime.dat" with linespoints linestyle 1
pause -1 "Hit Enter to continue"
I have a file containing some datapoints:
# energytime.dat
# X Y
64.934 1993
64.9264 0.0029
64.9022 1897
64.9296 1877
64.8698 1885
64.953 3799
I wrote the following script to plot a graph:
#!/usr/bin/gnuplot -persist
set title "Energy vs. Time for all algorithms"
set xlabel "Energy"
set ylabel "Time"
set style line 1 \
linecolor rgb '#0060ad' \
linetype 1 linewidth 2 \
pointtype 7 pointsize 1.5
plot "energytime.dat" with linespoints linestyle 1
pause -1 "Hit Enter to continue"
This gives the following graph:
It is obvious that this plot is wrong. What modifications should I make to my script to get the correct graph?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如@theozh所写,GNUPLOT只是按照数据文件中存储的顺序绘制数据。但是,您可以使用
平滑唯一
“更正”图形(假设您永远不会有两个相同的x值)。
注意
与之前使用
平滑唯一
很重要。As @theozh wrote, gnuplot simply plots the data in the order they stored in the datafile. However, you can "correct" your graph with
smooth unique
(assuming, that you will never have two identical x values).
NOTE
It is important, to use
smooth unique
beforewith
.