如何使用gnuplot绘制文件包含许多列和列标题

编程入门 行业动态 更新时间:2024-10-26 06:30:54
本文介绍了如何使用gnuplot绘制文件包含许多列和列标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一些这样的数据文件:

I have some data file like this:

Id a1 a2 a3 1 1 2 3 2 2 3 4 3 2 3 4

但是我不知道确切的列数,但是我可以使用shell将其放入变量中.我想绘制数据文件,在一张图片中将第一列作为x轴,将其他列作为y轴,并将列标题作为line的标题.

But I don't know the exact number of column, but I can get it into variable with shell. And I want to plot the data file, the first column as the x-axis and the others as the y-axis in one picture and the column header as the title for line.like this:

如何在gnuplot中绘制?非常感谢

How to plot in gnuplot? Many thanks

推荐答案

请考虑以下示例

colhead.gp :

plot for [i=2:n+1] 'colhead.dat' u 1:i w lp title columnheader(i)

colhead.dat :

Id a1 a2 a3 1 1 2 3 2 2 3 4 3 2 3 4

要从外壳获取参数:

gnuplot -persist -e "n=4" colhead.gp

更多推荐

如何使用gnuplot绘制文件包含许多列和列标题

本文发布于:2023-10-14 11:49:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1490972.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   标题   文件   gnuplot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!