#1182 Non-negative numbers are displayed too right in plots

closed
nobody
None
5
2012-10-11
2012-10-10
David J. López
No

I use gnuplot 4.6 in archlinux from official repository. I've noticed in that the non-negative numbers are slightly right-shifted from their axis ticks marks. See for example the first image in gnuplot homepage: http://www.gnuplot.info/figs/gaussians.png Numbers 2 and 4 in the x axis are not under the the ticks marks, they are too right.

I think that there is a extra space in the non-negative numbers. To illustrate, I've used an example

plot [-2*pi:2*pi] sin(x)

and exported the figure to tex with the epslatex terminal. The tex file includes the lines

\put(726,440){\makebox(0,0)[r]{\strut{}-1}}%
\put(726,873){\makebox(0,0)[r]{\strut{}-0.8}}%
\put(726,1307){\makebox(0,0)[r]{\strut{}-0.6}}%
\put(726,1740){\makebox(0,0)[r]{\strut{}-0.4}}%
\put(726,2174){\makebox(0,0)[r]{\strut{}-0.2}}%
\put(726,2608){\makebox(0,0)[r]{\strut{} 0}}%
\put(726,3041){\makebox(0,0)[r]{\strut{} 0.2}}%
\put(726,3475){\makebox(0,0)[r]{\strut{} 0.4}}%
\put(726,3908){\makebox(0,0)[r]{\strut{} 0.6}}%
\put(726,4342){\makebox(0,0)[r]{\strut{} 0.8}}%
\put(726,4775){\makebox(0,0)[r]{\strut{} 1}}%
\put(992,220){\makebox(0,0){\strut{}-6}}%
\put(1938,220){\makebox(0,0){\strut{}-4}}%
\put(2884,220){\makebox(0,0){\strut{}-2}}%
\put(3831,220){\makebox(0,0){\strut{} 0}}%
\put(4777,220){\makebox(0,0){\strut{} 2}}%
\put(5723,220){\makebox(0,0){\strut{} 4}}%
\put(6669,220){\makebox(0,0){\strut{} 6}}%

There is an extra space in the non-negative numbers (when plotting it will be invisible in the y-axis, but visible in the x-axis). The right values for 0, 2, 4 and 6 must be

\put(3831,220){\makebox(0,0){\strut{}0}}%
\put(4777,220){\makebox(0,0){\strut{}2}}%
\put(5723,220){\makebox(0,0){\strut{}4}}%
\put(6669,220){\makebox(0,0){\strut{}6}}%

without the space. Same happens in standard postscript terminal.

Discussion

  • Ethan Merritt
    Ethan Merritt
    2012-10-11

    The default format for printing tic labels is " %g" [note the leading space character]. That is intentional, but if you don't like it you can easily change it with the command
    set format "%g"

    If you want it to be like this always, put the command in /usr/local/share/gnuplot/4.6/gnuplotrc or ~/.gnuplot

     
    • status: open --> closed
     
  • Thanks sfeam. I didn't suppose this was intentional, for me it's hard to understand what's the point of putting numbers too right, but different people have different tastes.

    I've tested your "%g" solution removing space and it works fine. I close this bug.