Say in a datafile you have 10 points that you want to plot but on the plot itself there is no easy way to figure out the serial position of the data point in the file by just looking at the plot. of course one can estimate the coordinates of the datum and then compare against the values in the data file. but i find that a bit cumbersome so this is the solution i tend to use a lot.

contents of data.dat

1 3

5 9

4 6

2 9

3 8

2 1

1 9

9 9

2 2

5 5

gnuplot> plot “data.dat” u 1:2 w p pt 4 ps 2

produces the plot as shown below

gnuplot> plot “data.dat” u 1:2 w p pt 4 ps 2 ( thanks Swagat !!! )

gnuplot> plot “data.dat” u 1:2: w p pt 4 ps 2, ” ” using 1:2:(sprintf(“%d”,column(0))) with labels

however produces the following which makes my life a whole lot easier

a big thanks to the gnuplot google group and its helpful posters

http://www.gnuplot.info/docs/node253.html

### Like this:

Like Loading...

*Related*

on May 17, 2009 at 2:50 pm |swagatAre n’t the two commands same? I think you missed something … For putting labels, you need to have three columns ….

on May 17, 2009 at 7:13 pm |awhanmany thanks swagat for pointing out the mistake… i have made the corrections 🙂

on June 11, 2016 at 2:58 am |RobertoIs it possible to do same exact thing but with a matrix of data? plotted with splot ? Thank you