On Feb 18, 2008 9:34 AM, Robin <[EMAIL PROTECTED]> wrote:

> figs = [x[0] for x in results]
> oldaxs = [fig.get_children()[1] for fig in figs]
> for fig, ax in zip(figs,oldaxs):
>     fig.delaxes(ax)
>     pl.close(fig)

Probably better:

oldaxs = []
for fig in figs:
    for ax in fig.axes:
        fig.delaxes(ax)
        oldaxs.append(ax)
    pl.close(fig)

> Unfortunately, there are some problems:
> - while the subplots are correct, they don't resize when I resize the window
> - the plots are bar graphs, only the first xtick label is there, the
> others are missing
> - top of the xaxis of the bottom row of plots overlaps with the bottom
> of the x axis of the top row - generally it looks pretty bad
>
> Since this approach is proving problematic, and sounds like it isn't
> really supported anyway (I had imagined it would be relatively

It's not that it isn't supported, it's just rarely used and so may
have slowly broken over time.  It is useful, so It would be worthwhile
for us to fix it.  Are you using 0.91.2 or svn?

> straightforward) I think it would be better to try the other way
> (passing optional axes argument to plot to if I want it in a
> multi-subplot figure, otherwise just create a new figure). I would
> appreciate some pointers on how to do this. ie:

You might consider something like

def myfunc(ax=None):
    if ax is None:
        fig = figure()
        ax = fig.add_subplot(111)
    ax.plot(something)


> However I do not know how to make the bar, title, xlabel, xtick etc.
> commands I am using from pylab within the function act on the
> specified subplot axes (if present).
> Is this possible?

ax.set_xlabel('mylabel')
ax.set_title('my title')
ax.grid(True)

etc...  See help(matplotlib.axes.Axes)

JDH

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to