Fer*_*isi 12 gnuplot columnheader
我的问题很简单.假设我有一个带有列标题的数据文件,如下所示
first second
1 1
2 1
3 6
4 9
Run Code Online (Sandbox Code Playgroud)
在gnuplot中我如何使用列标题作为轴标签来绘制数据文件?例如通过电话
plot datafile using 1:2
Run Code Online (Sandbox Code Playgroud)
我得到了xaxis标签first和yaxis 标签second?
编辑:我知道我可以使用列标题作为键输入set key auto title column head,但这不是我正在寻找的.
要详细说明@andyras的建议,请按以下步骤操作:
datafile = 'filename.txt'
firstrow = system('head -1 '.datafile)
set xlabel word(firstrow, 1)
set ylabel word(firstrow, 2)
plot datafile using 1:2
Run Code Online (Sandbox Code Playgroud)
你必须使用显式using语句进行绘图,否则gnuplot会抱怨bad data on line 1.
我不认为这个功能是内置于 gnuplot 中的;您可能必须使用类似 awk 的实用程序从数据文件中提取这些标签。
您可以尝试在 gnuplot 的 sourceforge 站点上提交功能请求,并从那里的开发人员那里获取反馈。
| 归档时间: |
|
| 查看次数: |
8627 次 |
| 最近记录: |