Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Labelling individual data points gnuplot

Tags:

gnuplot

Just trying to get used to gnuplot. I searched a few pages on this site looking for the answer, read the documentation (4.6), and still haven't found the answer. say I have a data file like this:

0.0 0
1.0 25
2.0 55
3.0 110
4.0 456
5.0 554
6.0 345

and I want to label all the data points on the plot. How do I do this? I tried this suggestion plot 'exp.dat' u 1:2 w labels point offset character 0,character 1 tc rgb "blue" but it didn't work. It gave me a Not enough columns for this style response. I'm sure it's something I'm doing but I'm not sure what. Any help would be appreciated. Thanks.

like image 568
Matt Avatar asked Dec 06 '25 00:12

Matt


1 Answers

I think you are missing strings for labels. You can do

flabel(y)=sprintf("y=%.2f", y)
plot '-' u 1:2:(flabel($2)) w labels point offset character 0,character 1 tc rgb "blue"
0.0 0
1.0 25
2.0 55
3.0 110
4.0 456
5.0 554
6.0 345

enter image description here

like image 193
slitvinov Avatar answered Dec 09 '25 02:12

slitvinov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!