Yes, you are making it harder on yourself...
On Friday, August 12, 2011, Christopher Brown <c...@asu.edu> wrote:
> I feel like I'm doing this right, but it doesn't work. Any clues?
>
> from matplotlib import pyplot as pp
>
> pp.plot((1,2,3))
> ax = pp.gca()
At this point, a figure is implicitly created because none exists at this
point. The ax object is implicitly added to that.
> f = pp.figure(num=2)
This will be a completely new figure.
> print 'first: %i' % ax.figure.number
> print 'second: %i' % f.number
> f.add_axes(ax)
>
Since ax was already attached, it can't be in two figures at once, so the
assertion fails.
> yields:
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "C:\Python27\lib\site-packages\matplotlib\figure.py", line 606,
> in add_axes
> assert(a.get_figure() is self)
> AssertionError
>
>
So, just simply create your figure first, and call ax = f.gca() after.
There should be no need to call add_axes except in very special situations.
I hope that helps!
Ben Root
------------------------------------------------------------------------------
FREE DOWNLOAD - uberSVN with Social Coding for Subversion.
Subversion made easy with a complete admin console. Easy
to use, easy to manage, easy to install, easy to extend.
Get a Free download of the new open ALM Subversion platform now.
http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users