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:
Traceback (most recent call last):
File "test.py", line 10, in <module>
fig.draw_artist(textartist)
File "/usr/local/lib/python2.6/site-packages/matplotlib/figure.py", line 816,
in draw_artist
a.draw(self._cachedRenderer)
File "/usr/local/lib/python2.6/site-packages/matplotlib/artist.py", line 55,
in draw_wrapper
draw(artist, renderer, *kl)
File "/usr/local/lib/python2.6/site-packages/matplotlib/text.py", line 549,
in draw
bbox, info = self._get_layout(renderer)
File "/usr/local/lib/python2.6/site-packages/matplotlib/text.py", line 267,
in _get_layout
key = self.get_prop_tup()
File "/usr/local/lib/python2.6/site-packages/matplotlib/text.py", line 716,
in get_prop_tup
self.figure.dpi, id(self._renderer),
AttributeError: 'NoneType' object has no attribute 'dpi'
And here is some simple code to trigger the bug:
#!/usr/bin/env python
# display bug in figure.draw_artist(matplotlib.text)
import matplotlib.pyplot as plt
from matplotlib.text import Text
fig = plt.figure()
plt.draw()
textartist = Text(0.5, 0.5, "Foo")
fig.draw_artist(textartist)
plt.show()
#end code
Note that I still get the bug even when i specify figsize and dpi on the figure
like so:
fig = plt.figure(figsize=(2,2), dpi=300)
-Ben
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users