How to label vector in gnuplot

前端 未结 1 756
我在风中等你
我在风中等你 2021-01-24 03:58

I would like to know how to give a label at the end of a vector in gnuplot. I know it is possible to use \"set\" in gnuplot to show a certain label at some place, but I have hun

相关标签:
1条回答
  • 2021-01-24 04:17

    Imagine you have a file with the following data (which I named "temp"), where the first two coordinates are the origin and the last two coordinates are the x and y components (projections) of your vector:

    0 0 1 1
    0 0 1 2
    0 0 1 3
    0 0 1 4
    0 0 1 5
    

    Then you can do what you want with the following commands:

    set xrange [0:1.2]
    set yrange [0:6]
    plot "temp" with vectors, "temp" u 3:4:0 with labels left
    

    The first instance in plot is to plot the vectors with the same convention I mentioned above in the data file, the second instance is to place a label with coordinates x = column 3 and y = column 4 (that is, at the end of your vectors), with text = column 0 (which gives the order of your data entries) and flush it to the left from those coordinates. It looks like this: enter image description here

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