【问题标题】:how to plot file contains many columns and column header using gnuplot如何使用gnuplot绘制文件包含许多列和列标题
【发布时间】:2013-07-08 03:49:36
【问题描述】:

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

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

但我不知道确切的列数,但我可以用 shell 将它放入变量中。我想在一张图片中绘制数据文件,第一列作为 x 轴,其他列作为 y 轴,列标题作为行的标题。像这样:

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

【问题讨论】:

    标签: plot gnuplot


    【解决方案1】:

    考虑这个例子

    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
    

    从shell获取参数:

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

    【讨论】:

    • 如果您希望 for 循环获取所有列,我认为您希望将“n=4”作为输入。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多