artist.set_figure().
-Ben
-Original Message-
From: Jae-Joon Lee [mailto:lee.j.j...@gmail.com]
Sent: Monday, February 08, 2010 6:36 PM
To: Ben Axelrod
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] Figure.draw_artist() bug with Text
This is not a bug.
The exception
Figure.draw_artist is just a convenience function.
def draw_artist(self, a):
draw :class:`matplotlib.artist.Artist` instance *a* only --
this is available only after the figure is drawn
assert self._cachedRenderer is not None
I am getting a fault when I try to use Figure.draw_artist() with a
matplotlib.text.Text object. Since matplotlib.text.Text inherits from
matplotlib.artist.Artist, which is what draw_artist() takes, this should
probably work.
Tested with latest SVN code on Linux.
Here is the traceback:
This is not a bug.
The exception is raised simply because textartist.figure is None
(and it is None because you never set it).
textartist you created is not properly set up (no figure, no axes,
no transform). You may do
textartist = Text(0.5, 0.5, Foo)
textartist.set_figure(fig)