gonephishing
gonephishing

Reputation: 1416

Marking coordinates of the points plotted using gnuplot

I want to plot my graph that connects a few point using 'linespoints'

I also want a label against each of the plotted point marking the coordinate of the plotted point. If possible draw a line along x and y axis marking the coordinates of the plotted points.

Any help?

Upvotes: 4

Views: 1283

Answers (1)

sweber
sweber

Reputation: 2996

You can use the with vectors option to draw arrows from column 1 & 2 with the length given in column 3 & 4. The nohead removes the arrow tips. And with labels you can place a string given as third column. The left causes left aligned text (i.e. right of the coordinates), and the offset moves the text one character width to the right.

plot "data.csv" u 1:2 with linespoints, \
    '' u 1:2:(0):(-$2) with vectors, \
    '' u 1:2:(-$1):(0) with vectors nohead, \
    '' u 1:2:(sprintf("x=%.1f; y=%.1f", $1, $2)) with labels left offset 1, 0

enter image description here

Upvotes: 2

Related Questions