demo text path failing

Appears to be branch and trunk

johnh@...749...:pylab_examples> python demo_text_path.py
Traceback (most recent call last):
  File "demo_text_path.py", line 71, in ?
    transform=IdentityTransform())
  File "demo_text_path.py", line 27, in __init__
    mpatches.PathPatch.__init__(self, path, **kwargs)
  File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/patches.py",
line 736, in __init__
    Patch.__init__(self, **kwargs)
  File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/patches.py",
line 93, in __init__
    self.set_fill(fill)
  File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/patches.py",
line 316, in set_fill
    self.set_facecolor(self._original_facecolor)
AttributeError: 'PathClippedImagePatch' object has no attribute
'_original_facecolor'

This seems to be related to the recent change by Eric.
I just submitted a modified version of demo_text_path.py.

Eric, it seems to be happened because the "_original_facecolor"
property that you introduced is not initialized in __init__ method but
in the set_facecolor method. Is there any reason that this cannot be
initialized in the __init__ method?

Regards,

-JJ

···

On Fri, Nov 5, 2010 at 4:14 AM, John Hunter <jdh2358@...149...> wrote:

Appears to be branch and trunk

johnh@...749...:pylab_examples> python demo_text_path.py
Traceback (most recent call last):
File "demo_text_path.py", line 71, in ?
transform=IdentityTransform())
File "demo_text_path.py", line 27, in __init__
mpatches.PathPatch.__init__(self, path, **kwargs)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/patches.py",
line 736, in __init__
Patch.__init__(self, **kwargs)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/patches.py",
line 93, in __init__
self.set_fill(fill)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/patches.py",
line 316, in set_fill
self.set_facecolor(self._original_facecolor)
AttributeError: 'PathClippedImagePatch' object has no attribute
'_original_facecolor'

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Just to clarify, I first thought it is better to be initialized in the
__init__ method (since then you don't need to worry about it when you
override set_facecolor method), but after second thought, this may not
be necessary.

-JJ

···

On Fri, Nov 5, 2010 at 9:19 AM, Jae-Joon Lee <lee.j.joon@...149...> wrote:

Eric, it seems to be happened because the "_original_facecolor"
property that you introduced is not initialized in __init__ method but
in the set_facecolor method. Is there any reason that this cannot be
initialized in the __init__ method?

Eric, it seems to be happened because the "_original_facecolor"
property that you introduced is not initialized in __init__ method but
in the set_facecolor method. Is there any reason that this cannot be
initialized in the __init__ method?

As you found, it is initialized in the __init__ method when set_facecolor is called there. In general, I like using the "set" methods in __init__ when possible so as to reduce code duplication, and so as to make the setting of a parameter work the same with a "set" method as it does upon initialization.

Just to clarify, I first thought it is better to be initialized in the
__init__ method (since then you don't need to worry about it when you
override set_facecolor method), but after second thought, this may not
be necessary.

It looks to me like your fix of the demo is the correct way to handle the problem.

Eric

···

On 11/04/2010 02:38 PM, Jae-Joon Lee wrote:

On Fri, Nov 5, 2010 at 9:19 AM, Jae-Joon Lee<lee.j.joon@...149...> wrote:

-JJ

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel