TextWithDash: self._mytext AttributeError

Hi:

I obtain the following error when saving a figure to postscript after
running one of the test routines in mplot3d.py:

from numpy import *; import mpl3d.mplot3d as p3; import pylab as p
p3.test1()
p.savefig('test1')

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/local/lib/python2.4/site-packages/matplotlib/pylab.py",
line 811, in savefig
    return fig.savefig(*args, **kwargs)
  File "/usr/local/lib/python2.4/site-packages/matplotlib/figure.py",
line 660, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_ps.py",
line 1061, in print_figure
    self.figure.draw(renderer)
  File "/usr/local/lib/python2.4/site-packages/matplotlib/figure.py",
line 531, in draw
    for a in self.axes: a.draw(renderer)
  File "/usr/local/lib/python2.4/site-packages/mpl3d/mplot3d.py", line
714, in draw
    self.w_xaxis.draw(renderer)
  File "/usr/local/lib/python2.4/site-packages/mpl3d/mplot3d.py", line
613, in draw
    tick.draw(renderer)
  File "/usr/local/lib/python2.4/site-packages/matplotlib/axis.py",
line 161, in draw
    if self.label1On: self.label1.draw(renderer)
  File "/usr/local/lib/python2.4/site-packages/matplotlib/text.py",
line 1166, in draw
    self.update_coords(renderer)
  File "/usr/local/lib/python2.4/site-packages/mpl3d/mplot3d.py", line
411, in update_coords
    return text_update_coords(self, renderer)
  File "/usr/local/lib/python2.4/site-packages/mpl3d/mplot3d.py", line
102, in text_update_coords
    we = self._mytext.get_window_extent(renderer=renderer)
AttributeError: TextWithDash instance has no attribute '_mytext'

I installed matplotlib-0.87.3 and mpl3d yesterday and today. After a
bit of hunting, I noticed there are two similar definitions of
TextWithDash in matplotlib's text.py: _TextWithDash and TextWithDash.
Noting the underscored version defines _mytext but the underscore-free
version does not, I switched the underscores. Now things are working
(though perhaps I've broken something else in the process). I suspect
the error is a product of on-going changes to matplotlib; nonetheless,
I thought my email might be helpful to others.

Andrew

Thanks for the note. This is a known issue and has been addressed in
svn. The mplot modules have been added to svn and are being worked
on.

- Charlie

···

On 7/12/06, Andrew M. Bradley <ambrad@...200...> wrote:

Hi:

I obtain the following error when saving a figure to postscript after
running one of the test routines in mplot3d.py:

>>> from numpy import *; import mpl3d.mplot3d as p3; import pylab as p
>>> p3.test1()
>>> p.savefig('test1')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/local/lib/python2.4/site-packages/matplotlib/pylab.py",
line 811, in savefig
    return fig.savefig(*args, **kwargs)
  File "/usr/local/lib/python2.4/site-packages/matplotlib/figure.py",
line 660, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_ps.py",
line 1061, in print_figure
    self.figure.draw(renderer)
  File "/usr/local/lib/python2.4/site-packages/matplotlib/figure.py",
line 531, in draw
    for a in self.axes: a.draw(renderer)
  File "/usr/local/lib/python2.4/site-packages/mpl3d/mplot3d.py", line
714, in draw
    self.w_xaxis.draw(renderer)
  File "/usr/local/lib/python2.4/site-packages/mpl3d/mplot3d.py", line
613, in draw
    tick.draw(renderer)
  File "/usr/local/lib/python2.4/site-packages/matplotlib/axis.py",
line 161, in draw
    if self.label1On: self.label1.draw(renderer)
  File "/usr/local/lib/python2.4/site-packages/matplotlib/text.py",
line 1166, in draw
    self.update_coords(renderer)
  File "/usr/local/lib/python2.4/site-packages/mpl3d/mplot3d.py", line
411, in update_coords
    return text_update_coords(self, renderer)
  File "/usr/local/lib/python2.4/site-packages/mpl3d/mplot3d.py", line
102, in text_update_coords
    we = self._mytext.get_window_extent(renderer=renderer)
AttributeError: TextWithDash instance has no attribute '_mytext'

I installed matplotlib-0.87.3 and mpl3d yesterday and today. After a
bit of hunting, I noticed there are two similar definitions of
TextWithDash in matplotlib's text.py: _TextWithDash and TextWithDash.
Noting the underscored version defines _mytext but the underscore-free
version does not, I switched the underscores. Now things are working
(though perhaps I've broken something else in the process). I suspect
the error is a product of on-going changes to matplotlib; nonetheless,
I thought my email might be helpful to others.

Andrew

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users