How to label (x,y) data points in Gnuplot 4.2 with integer numbers

后端 未结 1 830
[愿得一人]
[愿得一人] 2021-01-03 07:18

I have a text file with 2 columns of numbers corresponding to (x,y) coords.

4 1
4 5
1 1
1 5
2.5 3

How do I tell gnuplot to plot these point

相关标签:
1条回答
  • 2021-01-03 08:07

    You can use the with labels flag to the plot command. By default this places the label instead of the point at the place where the point would be. with label takes the offset flag (and any flag you can pass to set label) so you can have the label next to the point. Here is an example script:

    #!/usr/bin/env gnuplot
    
    reset
    
    set terminal pngcairo
    set output 'test.png'
    
    set xr [0:5]
    set yr [0:6]
    
    plot 'data.dat' pt 7, \
         'data.dat' using 1:2:($0+1) with labels offset 1 notitle
    

    which produces this output:

    enter image description here

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