0
votes

I would like to plot this datafile

"/root/temp.txt"

LB|30|421
CN|50|247
BR|20|370
SA|12|310

Where the first column is the X Axis, the second one is the Y Axis and the third one the label to put above each column of the histogram.

Before now, I use this syntax to plot the graph (but without any label)

set terminal png ;
set title "Hello" ;
set xlabel "Country" ;
set ylabel "values" ;
set style fill solid ;
set xtic rotate -45 ;
set datafile separator "|" ;
set style data histograms ; 
plot '/root/temp.txt' using 2:xtic(1) notitle

But if I try to add labels gnu plot give me error!!

The syntax I use to add labels is plot '/root/temp.txt' using 2:xtic(1):3 with labels notitle

Could you please help me? Thank you

1
Could you also post how you are trying to add the labels? Then it is easier to see what is going wrong.Woltan
I would like to add the label (column 3). If i try plot '/root/temp.txt' using 2:xtic(1):3 with labels notitle it makes error...!user1047926

1 Answers

0
votes

I am not sure that you can compress into one plotting format, but you can use replot (or replot-like plot):

plot '/root/temp.txt' using 2:xtic(1) notitle, '' u ($0):2:3 with labels notitle

Empty '' induce reuse the last input(file). Now, it equals with '/root/temp.txt'

Solution with semi-replot

To be nicer:

plot 'temp.txt' using 2:xtic(1) notitle, '' u ($0+0.1):($2+1):3 with labels notitle

Shifted label

Oh! And don't forget to set output of png term!