#1198 rotated xtics cropped from plot in pngcairo


"minimal" script to produce the problem. (copied from -- http://stackoverflow.com/questions/14148342/gnuplot-4-6-xtics-label-disappear )

set key outside
set title "MY TITLE"
set timefmt "%m/%d/%Y-%H:%M:%S"
set format x "%m/%d %H:%M"
set xdata time
set ylabel "Y LABEL"
set xlabel "Time"
set grid
set xtics rotate by 90 offset 0,-5
set terminal pngcairo size 1000,500 font ",9"
set xtics font ",8.0"
set ytics font ",8.0"
set output 'test.png'
plot '-' using 1:2 with linespoints ti "legend"
01/01/2013-00:15 186557
01/01/2013-01:15 254654
01/01/2013-04:00 180146
01/01/2013-06:15 191059

The `xtic` labels don't appear on the plot with gnuplot 4.6.1 (or 4.7.0). The reason that I believe this is a bug is because if I inject a `set bmargin at screen 0.8` into the script before plotting, the xtics show up just fine and relative to the xlabel, a portion of the the xtics (labels) are clearly above the xlabel in the plot. However, without the `bmargin` line, no xtics show up at all, so their position relative to the xlabel seems to have changed. The position of the xlabel relative to the plot doesn't seem to have changed however.

Note that this behavior is not reproduced in the postscript terminal -- It seems to behave more or less as expected.

If it matters, this was tested on Ubuntu linux: (gnuplot build system Linux x86_64) -- Others report it "working" on gnuplot 4.4, although I don't have that version installed currently so I can't verify.

As an aside, is it inconvenient for you when I post the stackoverflow questions as a reference?


  • Matthew Gilson

    Matthew Gilson - 2013-01-04

    Also, if it matters, If you change the y-offset of the xtic from -1 to -2 to -3, the labels disappear at -3 -- If they're disappearing because they fall off the "canvas", there seems to be a bigger jump in the position of the label between yoffset -3 and -2 compared to -2 and -1. (hopefully that makes sense).

  • Ethan Merritt

    Ethan Merritt - 2013-01-04

    I don't think there is a bug here, although the placement is not guaranteed to be perfect especially for time format labels since the exact length is not so easy to predict in advance.

    The basic problem is that
    1) you specified a vertical offset of -5 character heights for the x tic labels
    2) the default justification of the tic label text is "center" rather than "right", so the rotation is not happening about the point you may have thought

    If you change the one line in your script to
    set xtics rotate by 90 offset 0,0 right
    it comes out fine at least as tested here.


    A pointer to a bug thread elsewhere is fine, although I am more likely to respond here.

  • Matthew Gilson

    Matthew Gilson - 2013-01-04

    Thanks again for the quick response, and sorry for submitting another non-bug ticket :). You're correct that changing the justification is a better solution than my `bmargin` hack.

  • Ethan Merritt

    Ethan Merritt - 2013-01-08
    • status: open --> closed-works-for-me

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks