Jos?> Hello, Matplotlib has been helping me a lot with my graphic
Jos?> needs. I am still surprised by the looking of the
Jos?> pictures. Many thanks for the great software.
Jos?> I'm having some issues, though. Sometimes I get error
Jos?> messages, usually an error in KERNEL32.DLL on Windows ME,
Jos?> and on Windows only, I don't get this behaviour in
Jos?> Linux. It's not as bad as it may seem, as every script runs
Jos?> completely, the pictures are saved and, besides the message
Jos?> box informing the error, nothing weird happens. I don't know
Jos?> how to reproduce the errors - when I run from the DOS prompt
Jos?> or from IDLE, I get the messages. When I run from my IDE (I
Jos?> use PSPad) I usually don't get error messages, with the same
Jos?> scripts. Any hint to what I can be doing wrong, or how to
Jos?> find out what is happening?
I haven't seen this one before. Intermittent errors are the hardest
to track down. What GUI is PSPad based on. Is any of the information
at http://matplotlib.sourceforge.net/faq.html#FREEZE helpful?
Jos?> Also, I'm in need of some help. I must draw six subplots,
Jos?> one below the other (subplot(6, ...)), but the way things
Jos?> are coming out, the plots are to thin, and, although the
Jos?> picture looks good, I thought that if I could make each
Jos?> subplot a little bigger, that would help a lot. Is there any
Jos?> way this can be done?
subplot is simply a thin wrapper to axes -
http://matplotlib.sf.net/matplotlib.matlab.html#-axes . You can use
axes to make the axes any size you want. The syntax is
# left, bottom, width, height
ax1 = axes([0.125, 0.1, 0.7, .8])
where all values are fractions of the total figure size. See
http://matplotlib.sourceforge.net/examples/ganged_plots.py for an
example where no space is left between the axes, and xlabels are put
only on the bottom.
Jos?> In other plots, I need to index the subplots (label them
Jos?> '(a)', '(b)', ... for reference in text). I was using xlabel
Jos?> to do that, but when I have more than two subplots, the
Jos?> xlabel is shadowed by the following subplot. Is there any
Jos?> way to make the space between the plots bigger, so the
Jos?> xlabels can be shown, or is there any other (better) way to
Jos?> do that?
You can use the text command to place text anywhere in the figure you
want - http://matplotlib.sourceforge.net/matplotlib.matlab.html#-text.
You can place text in data coordinates
text(.5, 12, 'hi mom')
in which case the text will "move" visually if you pan and zoom the
axes, or in axes coordinates (0,0) is lower left and 1,1 is upper
right, in which case the text will remain stationary with respect to
changes in the axes limits
text(0.05, 0.9, 'hi mom', transform=gca().transAxes)
See http://matplotlib.sourceforge.net/examples/alignment_test.py for
lots of examples showing text placement and alignment.
You can also place text outside the axes using the text command
# to the left and above the axes box
text(-0.1, 1.05, 'hi mom', transform=gca().transAxes)
Hope this helps,
JDH