gnuplot specify column for label

前端 未结 1 1155
执念已碎
执念已碎 2021-01-21 00:32

I am doing a multiplot in gnuplot. I want to pick the labels for the points from certain columns. For example, say the data file is:

 year temp label1 year humid         


        
1条回答
  •  迷失自我
    2021-01-21 01:23

    Use the labels style. This style expects to receive the x and y coordinates along with the label column.

    For your data, and the first part of the plot, we can do

    plot 'weather.data' using 1:2 with points, '' using 1:2:3 with labels
    

    If we wish to add a little spacing, we can adjust the label y coordinate. For example, moving it up by 1 unit with

    plot 'weather.data' using 1:2 with points, '' using 1:($2+1):3 with labels
    

    For this plot, in order to make sure that everything fit completely inside, I manually set the xrange to [1989:1993] and the yrange to [20:35].

    A similar approach works with your other columns of data, which can, of course, be combined with this as normal (although with the massively different y range, probably should be done on it's own plot, or using a secondary axis).

    See help labels for more information.

    0 讨论(0)
提交回复
热议问题