On 11/09/2010 07:57 PM, Jae-Joon Lee wrote:
> On Wed, Nov 10, 2010 at 12:21 AM, Benjamin Root<ben.r...@ou.edu>  wrote:
>    
>> On Tue, Nov 9, 2010 at 7:24 AM, Jae-Joon Lee<lee.j.j...@gmail.com>  wrote:
>>      
>>> Thanks for tracking down this.
>>> It turned out to be a silly error while adjusting the line end-point.
>>> I'm attaching the patch. Please test the patch if you can.
>>> I'll commit the change sometime tomorrow.
>>>
>>>        
> Thanks. I can reproduce the problem.
>
> aa = ax.annotate('', (1,1),
>                   (-10,-10),
>                   arrowprops=dict(arrowstyle="-|>",
>                                   fc="w", ec="k",lw=30,
>                                   path_effects=[Stroke(joinstyle='miter')])
>                   )
>
> The erroneous behavior happens when one tries to draw a path that
> connects points far outside of the canvas (point 10,10 in above
> example). And this is a AGG-specific issue.  The erroneous behavior
> goes away if we clip the path.
>
> aa.arrow_patch.set_clip_box(ax.figure.bbox)
>    
It's good to know this works.  No need to implement a clipping function 
of our own, as I previously alluded to.
> I try to reproduce the problem with simple plot command, but couldn't.
> Maybe this happens only for rendering bezier splines?
> Michael, any idea?
>    
Matplotlib has its own clipping algorithm that works only on simple 
paths (paths without a codes array).  Basic line plots fit into this 
category.  The reason matplotlib does this rather than always relying on 
Agg is a) so it works in all backends, thereby saving considerable file 
size in vector files, and b) removing the line segments outside of the 
image bounds before they get stroked by Agg saves considerable time.  
However, this clipping algorithm is pretty simple and doesn't handle 
filled shapes or bezier curves, so it's turned off in those cases.
> One thing I may do to prevent it is to set the clip_path of the arrow
> to the figure.bbox by default.
> I'll think about it.
>    
It may make more sense to apply a global clipping rectangle of the 
figure to every operation (at least in the Agg backend) -- then we've 
fixed this once and for all.

Mike
> Regards,
>
> -JJ
>
>
>    
>>> Regards,
>>>
>>> -JJ
>>>
>>>
>>> On Tue, Nov 9, 2010 at 9:15 PM, Jason Grout<jason-s...@creativetrax.com>
>>> wrote:
>>>        
>>>> I've been trying to track down a problem in the arrows where the arrow
>>>> seems to be off by a little bit.  I've narrowed down the problem to a
>>>> small example:
>>>>
>>>> import matplotlib.patches as mpatches
>>>> import matplotlib.pyplot as plt
>>>> fig=plt.figure()
>>>> ax = fig.add_subplot(111, xlim=(.98,1.02),
>>>> ylim=(.98,1.02),aspect='equal')
>>>> from matplotlib.patheffects import Stroke
>>>>
>>>> ax.annotate('', (1,1),
>>>>              (0,0),
>>>>              arrowprops=dict(arrowstyle="-|>",
>>>>                              fc="w", ec="k",lw=30,
>>>>                              path_effects=[Stroke(joinstyle='miter')]),)
>>>> ax.plot([0,1],[1,1])
>>>> ax.plot([1,1],[0,1])
>>>> ax.plot([0,1.02],[0,1.02])
>>>>
>>>> fig.savefig('test.png')
>>>>
>>>>
>>>> I've used a miter join above because it illustrates the problem better.
>>>>   Notice that the arrowhead tip is just below the line, but should be
>>>> right on the line.  Any clue about what the problem is?
>>>>
>>>> Thanks,
>>>>
>>>> Jason
>>>>
>>>> --
>>>> Jason Grout
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> 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-users mailing list
>>>> Matplotlib-users@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>>          
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> 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-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>        
>> Jae-Joon,
>>
>> I just tested out the patch, and while it did seem to fix the problem for me
>> on the test script, I am not 100% certain that it is properly lined up
>> (maybe an off-by-one-pixel error?).  Anyway, I tried zooming in to see which
>> kind of error it was and I got a very weird image.  I am not certain exactly
>> what triggers it, but I think if the rubber-banding does not incorporate the
>> entire arrow-head, then the distortion appears.  I was also able to
>> reproduce the distortion without the patch (although I think it was easier
>> to cause with the patch).
>>
>> Ben Root
>>
>>
>>      
> ------------------------------------------------------------------------------
> 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-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>    


-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA


------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to