|
From: Robin <ro...@gm...> - 2008-03-12 19:50:32
|
On Wed, Mar 12, 2008 at 7:37 PM, Christiaan Putter
<cep...@go...> wrote:
>
> Look for a thread titled 'subplots from existing figures' (5th March) or
> something similar. I posted a function there that takes in a list of
> figures and spits out a new one containing those. There is still a bug in
> it though. For some reason copying axes from one figure to another seems to
> be broken. ie. the axes can't be resized properly after being copied.
I had tried a similar thing, only less general (I only had two plots
to add to the same figure). I hit the same problem - the axes wouldn't
resize when the window was resized, and also some of my axes tick
labels were lost (oddly the first xticklabel was there but the others
were missing).
I found a way round it by getting the individual plotting functions to
accept an optional axes argument that they plot to...
def make_one_fig(ax=None):
fig = None
if ax is None:
fig = figure() ...
ax = fig.add_subplot(111)
ax.plot (..)
return fig
Then if called without ax set this plots as before, but if you want to
build up a set of plots:
fig = figure()
ax = fig.subplot(211)
make_one_plot(ax=ax)
etc
Robin
|