gnuplot 2d 绘图到 3d 栅栏图
我有一个看起来像这样的情节:
但是这些行重叠很多,我看不到我想要的那么多。我的 gnuplot 脚本如下所示:
set autoscale
set term pdfcairo font ",4"
set output "plot.pdf"
set xdata time
set format x "%H:%M"
set timefmt "%s"
set yrange [0:550]
plot "file.dat" every 150 using 3:4 title '' with lines, \
"file.dat" every 150 using 3:5 title '' with lines, \
"file.dat" every 150 using 3:6 title '' with lines, \
"file.dat" every 150 using 3:7 title '' with lines, \
"file.dat" every 150 using 3:8 title '' with lines, \
"file.dat" every 150 using 3:9 title '' with lines, \
"file.dat" every 150 using 3:10 title '' with lines, \
"file.dat" every 150 using 3:11 title '' with lines
相应的 file.dat
如下所示:
(.........)
6 1303238171 0 134.332413 140.304581 138.496323 134.021835 105.546227 107.943008 102.812347 109.098152 972.554886
7 1303238171 0 134.232849 140.35408 138.186279 132.489319 105.941231 108.020004 103.009338 109.75119 971.98429
8 1303238171 0 135.125488 138.125427 138.100098 132.543625 106.153214 107.507042 102.338707 125.25383 985.147431
9 1303238171 0 134.341904 139.913376 138.070648 132.368164 106.214211 108.506859 102.963211 155.246277 1017.62465
10 1303238171 1 134.163055 140.042313 139.231033 132.444244 106.161438 108.850807 103.753929 162.19162 1026.838439
11 1303238171 1 134.179016 140.187561 138.68425 132.572876 107.169006 107.507057 102.974937 120.698692 983.973395
12 1303238171 1 134.40593 140.569382 138.604828 139.589264 106.631699 108.092957 103.634117 108.943863 980.47204
13 1303238172 1 134.353363 138.062759 138.344818 140.665985 107.538544 108.983582 104.300827 175.732117 1047.981995
14 1303238172 1 135.190887 140.411484 138.174591 133.823929 105.412224 108.240623 102.790154 120.459106 984.502998
(.........)
是否有一种 简单 方法可以让该图表看起来像 gnuplot 示例页面?我看了一下,好像真的很复杂。我希望我可以轻松添加第三个维度而不更改 file.dat
。你知道实现这一目标的方法吗?或者您还有其他想法如何使该图表更好地可读吗?
此致,
i have a plot looking like this:
However the lines are overlapping quite a lot and i'm not able to see as much as i'd like. My gnuplot script looks like this:
set autoscale
set term pdfcairo font ",4"
set output "plot.pdf"
set xdata time
set format x "%H:%M"
set timefmt "%s"
set yrange [0:550]
plot "file.dat" every 150 using 3:4 title '' with lines, \
"file.dat" every 150 using 3:5 title '' with lines, \
"file.dat" every 150 using 3:6 title '' with lines, \
"file.dat" every 150 using 3:7 title '' with lines, \
"file.dat" every 150 using 3:8 title '' with lines, \
"file.dat" every 150 using 3:9 title '' with lines, \
"file.dat" every 150 using 3:10 title '' with lines, \
"file.dat" every 150 using 3:11 title '' with lines
and the corresponding file.dat
looks like this:
(.........)
6 1303238171 0 134.332413 140.304581 138.496323 134.021835 105.546227 107.943008 102.812347 109.098152 972.554886
7 1303238171 0 134.232849 140.35408 138.186279 132.489319 105.941231 108.020004 103.009338 109.75119 971.98429
8 1303238171 0 135.125488 138.125427 138.100098 132.543625 106.153214 107.507042 102.338707 125.25383 985.147431
9 1303238171 0 134.341904 139.913376 138.070648 132.368164 106.214211 108.506859 102.963211 155.246277 1017.62465
10 1303238171 1 134.163055 140.042313 139.231033 132.444244 106.161438 108.850807 103.753929 162.19162 1026.838439
11 1303238171 1 134.179016 140.187561 138.68425 132.572876 107.169006 107.507057 102.974937 120.698692 983.973395
12 1303238171 1 134.40593 140.569382 138.604828 139.589264 106.631699 108.092957 103.634117 108.943863 980.47204
13 1303238172 1 134.353363 138.062759 138.344818 140.665985 107.538544 108.983582 104.300827 175.732117 1047.981995
14 1303238172 1 135.190887 140.411484 138.174591 133.823929 105.412224 108.240623 102.790154 120.459106 984.502998
(.........)
Is there an easy way to get this chart looking like a fence plot like on the gnuplot examples page? I looked over it and it seems to be really complicated. I wish i could easily add a third dimension without changing the file.dat
. Do you guy's perhaps know a way to achieve this? Or do you have any other ideas how i can make this chart better readable?
Best regards,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许我没有正确理解你的问题。但由于您在 x 轴上绘制时间,因此将其制作成 3d 图似乎很尴尬,因为时间只是一个一维值。如果您处理表面(2d 数据),通常会得到 3d 绘图,其中您可以根据(至少 1d 数据)绘制温度、压力甚至时间。
为了使绘图更具可读性,并且根据您的数据,多重绘图可能会让事情变得更轻松。然后您可以将数据分组到几个图中,从而可以为 y 轴设置新的范围?!
如果我可以指出您的脚本的一些简化:
像这样使用迭代功能:
并使该线更加清晰:
然后,如果您不想在绘图中使用图例:
请注意,我没有测试上面的几行,因此可能有其中有一些错别字^^。
Maybe I do not understand your problem correctly. But since you are plotting the time on the x-axis, it seems awkward to make that into a 3d plot, since time is only a one dimensional value. You typically have 3d plots if you are dealing with surfaces (2d-data), where you plot the temperature, pressure or maybe even time against (at least 1d-data).
To make the plot more readable and depending on your data maybe multiplots can lighten things up. Then you can group your data in a couple of plots making it possible to set new ranges for the y-axis?!
If I may point out some simplifications to your script:
Make use of the iteration functionality like so:
And to make that line a little more crisp:
And then again, if you do not want a legend in your plot:
Be advised I didn't test the few lines above, so there might be some typos in them^^.