是否可以从文件中读取gnuplot中标签的值

时间:2015-05-05 07:38:06

标签: gnuplot

在gnulot中创建标签非常简单

set label "<value>" at <x,y> ...

但是我想从文件中读取gnuplot中标签的值。

文件中的行看起来像这样:

...
400 300 8 0.200214 1.00193 7.42157 8.623714 86.06 13.94 1.26
800 600 1 0.2055 0.1938 34.9172 35.3165 98.86 1.14 1.00
800 600 2 0.2066 1.5514 21.1664 22.9244 92.33 7.67 1.54
800 600 4 0.2027 1.6316 14.9445 16.7788 89.06 10.94 2.10
800 600 8 0.242 1.8385 12.7261 14.8066 85.94 14.06 2.38
1024 768 1 0.2212 0.2217 55.1782 55.6211 99.20 0.80 1.00
...

我只需要将第10列中的值作为标签。

是否有可能实现这样的目标:

set label from <inputfile> <column_of_inputfile> <row_of_inputfile> ...

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

这个解决方案对我有用:

set title "800x600"

set xlabel "Nodes [#]\n"         
set ylabel "Speedup" offset 2
set xrange [-0.55:3.55]
set yrange [0:5]
set style data histograms         # plot boxes
set boxwidth 0.75                 # have a gap between the boxes

plot 'inputfile.csv' every ::9::12 using 10:xtic(3) title "800x600" lc rgb "grey",\
      '' every ::9::12 using :10:10 with labels center  offset 0,1 tc rgb "black"

第一个情节线详细说明:

  • every :: 9 :: 12 =&gt;绘制输入文件的第9-12行。
  • 使用10:xtic(3) =&gt;列号10的值指定数据直方图的高度。第3列的值用于标记x轴。

第二条曲线将第9-12行第10列的内容绘制为数据直方图上方中心方向的标签。

图像显示结果。

Gnuplot result with labels obove boxes. The values come from the input file