Subplots.

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

John Hunter wrote:

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?

PSPad is based on native toolkit, I think. It is not open source,
though it is freeware. Information on the FAQ didn't help, but I
tried running some of the examples and my scripts on every IDE,
and got basically the same results. I think the DOS box message
error is the most helpful of them, but not that much.

Double-clicking from Windows Explorer: Microsoft Visual C++ Runtime
Error - abnormal programa termination

DOS command line:
   Fatal Python Error: PyEval_RestoreThread: NULL state

Interpreter running in a DOS box: shows no error, but gives me
a Microsoft Visual C++ error as above when I quit the DOS box.

IDLE: shows no error, but gives me a Microsoft Visual C++ error
as above.

Pyshell: BSODs.

I noticed, however, that it only happens when I save the figure,
and _never_ when I show them in a windows. And, in every case, the
picture is saved with no problems before the error occurs. I am
using the previous binary version of matplotlib (I'm downloading
the newest version right now and will test as soon as possible),
with Python-2.3.4. I double-checked to see if I was using the
right versions (it could have happen), but I don't think that this
is the problem. If there is any other information that could be
helpful, I can find it here.

You can use
axes to make the axes any size you want. The syntax is

I'm sorry to ask so simple questions. The main reason is that the
matlab interface is so simple that I rarely need to do more than
what it provides. This will help a lot, thanks!

···

---
Jos� Alexandre Nalon
nalon@...166...