I have plotted a file containing string and numbers as x labels with following code

plot "fileaskinf.dat" u 2:xticlabels(1) t "teams"

The file contents are

A-Team  0.05    
0.5 0.03    
0.6 0.05  
0.7 0.07   
S-team  0.05

How can I produce offset at the extreme of plots to see where the label "A-team" and "S-team" value resides at y axis. I am also getting vertical line. I don't know why.

enter image description here

1 Answer 1


It looks like when you supply categorical data (i.e. xticlabels), the tics are separated by 1 unit and start from 0. If you know the number of categories you can therefore hard-code an adjustment using xrange. More generally, you can calculate an adjustment based on the GPVAL_DATA_X_MIN and GPVAL_DATA_X_MAX values, ex. :

plot "fileaskinf.dat" u 2:xticlabels(1) t "teams"
set xrange[GPVAL_DATA_X_MIN-0.5:GPVAL_DATA_X_MAX+0.5]

See also gnuplot: max and min values in a range

I don't know what is causing the vertical line in your plot - I cannot reproduce it in Gnuplot 5.2 with the default wxt terminal.

  • Thanks it worked for me. Do you know how i can plot same file with yerrorbars from third column (not shown in file). I tried plot "fileaskinf.dat" u 2:xticlabels(1):3 w yerrorbars but i get last column value in the x axis, which is wrong Jul 19, 2020 at 11:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .