如何将y轴的值与gnuplot中形成的线一起打印?

时间:2017-04-29 03:06:27

标签: linux gnuplot

我使用了以下命令并获得了如下图所示的图表。

gnuplot> set xlabel "Input (N)"
gnuplot> set xrange [0:590]
gnuplot> set ylabel "Time (secs)"
gnuplot> set yrange [0:0.5]
gnuplot> set title "MATRIX ADDITION-Sequential VS Parallel program run in Cluster"
gnuplot> set for [i=0:24] xtics (0,25*i)
gnuplot> plot 'madd.csv' using 1:2 with lines title "Sequential Program" \
        lc rgb "blue" lw 4, 'madd_spp.csv' using 1:3 with lines \
        title "Parallel Program " lc rgb "green" lw 4

Gnuplot output

现在我需要在使用gnuplot绘图后获得的行中打印y轴的值。我该怎么做?

1 个答案:

答案 0 :(得分:1)

您可以使用gnuplot' s labels样式:

plot 'madd.csv' using 1:2 with lines title "Sequential Program" \
lc rgb "blue" lw 4, '' using 1:2:2 with labels tc rgb "blue" notitle, \
'madd_spp.csv' using 1:3 with lines title "Parallel Program " \
lc rgb "green" lw 4, '' using 1:3:3 with labels tc rgb "green" notitle

如果标签过多地碰到你的线条,你可以给它们一个偏移量:

plot 'madd.csv' using 1:2 with lines title "Sequential Program" \
lc rgb "blue" lw 4, '' using 1:2:2 with labels tc rgb "blue" notitle, \
'madd_spp.csv' using 1:3 with lines title "Parallel Program " \
lc rgb "green" lw 4, '' using 1:3:3 with labels tc rgb "green" offset 2 notitle