【问题标题】:plot data with errorbars and sort them with gnuplot使用误差线绘制数据并使用 gnuplot 对其进行排序
【发布时间】:2019-05-17 14:00:35
【问题描述】:

我有一个文件statistics.dat,其中包含我所做的测量。它的格式为

node Mean     StdDev
1    11862.4  142.871
2    11722.4  141.330 
[...]

我可以用plot '< sort -n -k2 statistics.dat' u 2制作一个排序图

现在我想在我的情节中添加误差线。当我使用 plot 'statistics.dat' u 1:2:3 w errorbars 时,排序显然丢失了,因为 gnuplot 使用 x 和 y 值作为坐标。

有没有办法绘制带有误差线的排序图? 还是我需要根据排序后的位置对数据进行排序并添加新的 x 值?

【问题讨论】:

    标签: linux gnuplot


    【解决方案1】:

    在这种情况下,从第 1 列读取 x 坐标会适得其反。要使用排序文件的顺序,请使用第 0 列(行号):

      plot '< sort -n -k2 statistics.dat' u 0:2:3 w errorbars
    

    根据您的数据性质和您试图在图中显示的内容,最好使用第 2 列中的平均值作为 x 坐标(无需额外排序):

      plot 'statistics.dat' using 2:2:3 with errorbars
    

    如果原始文件顺序具有某种内在意义,您可能还想以某种方式对原始顺序进行编码,可能是 x tic 标签,可能是颜色范围:

      plot 'statistics.dat' using 2:2:3:1 with errorbars lc palette
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-09-05
      • 1970-01-01
      • 2016-06-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多