如何将数据文件的第一行视为 gnuplot 中的列标签?
我有一个像这样的表:
A B C D E F G H I
10 23998 16755 27656 17659 19708 20328 19377 18925
20 37298 33368 53936 41421 44548 40756 40985 37294
我使用此命令来绘制
plot "C:/file.txt" using 1:2 with lines smooth bezier, "C:/file.txt" using 1:3 with lines smooth bezier, ...
但是,所有标签都以文件名的形式出现。 gnuplot 是否可以读取第一行并相应地标记这些行?
I have a table like this:
A B C D E F G H I
10 23998 16755 27656 17659 19708 20328 19377 18925
20 37298 33368 53936 41421 44548 40756 40985 37294
I use this command to plot
plot "C:/file.txt" using 1:2 with lines smooth bezier, "C:/file.txt" using 1:3 with lines smooth bezier, ...
However, all the labels come out as the file name. Is it possible for gnuplot to read the first row and label the lines accordingly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
n
从2开始跳过头部。n
starts from 2 to skip the header.我检查了文档,没有找到自动执行此操作的方法,但您可以使用以下命令手动设置标题
I checked the documentation and I don't see a way to do it automatically, but you can manually set a title with
我曾经写过该脚本可沿从 87MHz 到 108MHz 的轴绘制 FM 广播电台频率,使用每个广播电台的名称作为垂直标签。 这不是一个纯粹的 gnuplot 解决方案,输入文件是用 perl 和 make 处理的,但我建议你看一下它,看看是否可以使用类似的东西。
I once wrote a script to plot FM radio station frequencies along an axis from 87MHz to 108MHz, using the names of each radio station as vertical labels. This was not a pure gnuplot solution, the input file is processed with perl with make, but I suggest you have a look at it and see if you can use something like that.
如果您想要大量数据,您还可以使用 gnuplot 工具包,例如 Python 版绘制并且您想要自动提取标题。
You could also use a gnuplot toolkit such as this one for Python if you want have a lot of data to plot and you want to automate the extraction of the titles.