clipping of x label in matplotlib

Hi Jonas,

Thanks for the email. In the future would you mind posting questions
to the mailing list
http://lists.sourceforge.net/mailman/listinfo/matplotlib-users so
others can benefit from / contribute to the discussion?

    > Hi There, I was just trying out your matplotlib .31 on
    > gentoo-1.4 (gnu/linux) with pygtk 1.99.16 and python 2.2.3.
    > First, thanks for putting this impressive package together;
    > plotting is a barrier to entry for python, and the adoption
    > of the matlab syntax is clean.

    > Onto my issue: I noticed that the x label in a plot I
    > created from your tutorial gets clipped below both in the
    > window and in the png file created by the save button.

Hmm. From you screenshot you sent, I assume you are using this
example

    from matplotlib.matlab import *
    font = {'fontname' : 'Courier',
            'color' : 'r',
            'fontweight' : 'bold',
            'fontsize' : 11}

    plot([1,2,3])
    title('A title', font, fontsize=12)
    text(0.5, 2.5, 'a line', font, color='k')
    xlabel('time (s)', font)
    ylabel('voltage (mV)', font)
    show()

When I plot this example with matplotlib 0.31, I do not get the
clipping you showed in the screenshots you sent. However, from your
screenshot, it looks like you have increased the default fontsize to
larger than 11. Are you using a larger size? If I make the fontsize
much larger, say 20, I can reproduce the xlabel clipping you showed.

I don't know if this is a bug or a feature :-). Since you can make
the text arbitrarily large, at some point it will extend beyond the
boundaries of a figure of a given size. How do you think it should
behave? Resize the axes/figure? Warn the user? I'll have to think
about it.

That said, there is a parameter you can tweak to fix this problem if
you want larger fonts. In matplotlib/backends/backend_gtk.py on line
761, you can increase the screenDPI parameter, say to 150, which will
enable larger fonts relative to your plots. I am still not decided on
how the defaultDPI should be set in a device independent way, since
the actual DPI is display dependent. I'm considering setting up a
config file so users can customize things like their default fonts,
DPIs, figsizes, backend, etc....

John Hunter