如何将数据文件的第一行视为 gnuplot 中的列标签?

发布于 2024-07-18 04:17:09 字数 374 浏览 4 评论 0原文

我有一个像这样的表:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

手长情犹 2024-07-25 04:17:09
set key autotitle columnhead
set key autotitle columnhead
浮华 2024-07-25 04:17:09
plot for [n=2:12] 'vv.csv' u 1:(column(n)) w lines title columnhead(n)

n 从2开始跳过头部。

plot for [n=2:12] 'vv.csv' u 1:(column(n)) w lines title columnhead(n)

n starts from 2 to skip the header.

吐个泡泡 2024-07-25 04:17:09

我检查了文档,没有找到自动执行此操作的方法,但您可以使用以下命令手动设置标题

plot "file.txt" using 1:2 title "A" with lines smooth bezier ...

I checked the documentation and I don't see a way to do it automatically, but you can manually set a title with

plot "file.txt" using 1:2 title "A" with lines smooth bezier ...
您的好友蓝忘机已上羡 2024-07-25 04:17:09

我曾经写过该脚本可沿从 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.

诗笺 2024-07-25 04:17:09

如果您想要大量数据,您还可以使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文