[英]Labels on the input data in gnuplot
我有一个看起来像这样的数据文件
#index name1 name2 name3
1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7
我想绘制3行:
plot "data" using 1:2 with lines,\
...
除线条标签外,这样做没问题。 如何在数据文件中指定列名?
如果你有gnuplot 4.2或更新版本,你可以相当容易地做到这一点。 您需要删除第一行中的注释标记。
使用这样的文件:
index name1 name2 name3
1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7
以下将做你想要的:
set key autotitle columnheader
plot 'a.dat' u 1:2 w l, '' u 1:3 w l, '' u 1:4 w l
如果我在绘图之前set term dumb
,我会得到一个漂亮的ascii情节。 我爱gnuplot!
7 ++----------+----------+-----------+-----------+----------+---------$$$
+ + + + + name1$****** +
| $name2 ###### |
| $$$$$$ name3 $$$$$$ |
6 ++ $$$$$$ ###
| $$$$$$ ###### |
| $$$$$$ ###### |
| $$$$$$ ###### |
5 ++ $$$$$ ###### ***
| $$$$$$ ###### ****** |
| $$$$$$ ###### ****** |
| $$$$$$ ###### ****** |
4 $$$ ##### ****** ++
| ###### ****** |
| ###### ****** |
| ###### ****** |
3 ### ***** ++
| ****** |
| ****** |
+ ****** + + + + + +
2 ***---------+----------+-----------+-----------+----------+----------++
1 1.5 2 2.5 3 3.5 4
的columnHeader(n)的
比set key autotitle columnheader
更详细/更灵活:
plot 'my.dat' using 1:2 title columnheader(2), \
'' using 1:3 title columnheader(3)
测试了Gnuplot 4.6,Ubuntu 15.10。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.