Re: [Matplotlib-users] Suggestion for annotation arrow clipping

2011-09-14 Thread Jae-Joon Lee
On Mon, Sep 12, 2011 at 3:20 AM, Daniel Hyams dhy...@gmail.com wrote:
 I would suggest the following modification to Annotation.draw in
 text.py.  All it does is set a clip box so that the annotation and
 arrow is still drawn, but the arrow is clipped at the axes boundary.
 It is a much nicer effect than the annotation disappearing.  I have
 made this modification in my source locally, and it works very well,
 but I thought I would suggest here for inclusion into the main code
 base.


Can you explain more explicitly why you think this behavior is better?
For example, what is the point of annotating something if that
something is not visible?
Also, annotating texts are often placed outside of axes area. I don't
think clipping out the arrow is a good idea in this case.

Just in case, this is just a default behavior. You can override this
behavior without changing the mpl source code.

Regards,

-JJ

--
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Suggestion for annotation arrow clipping

2011-09-14 Thread Daniel Hyams
You are correct JJ; the annotation_clip=False attribute was exactly
what I was after, but somehow missed it in the docs :(.



On Wed, Sep 14, 2011 at 9:09 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote:
 On Mon, Sep 12, 2011 at 3:20 AM, Daniel Hyams dhy...@gmail.com wrote:
 I would suggest the following modification to Annotation.draw in
 text.py.  All it does is set a clip box so that the annotation and
 arrow is still drawn, but the arrow is clipped at the axes boundary.
 It is a much nicer effect than the annotation disappearing.  I have
 made this modification in my source locally, and it works very well,
 but I thought I would suggest here for inclusion into the main code
 base.


 Can you explain more explicitly why you think this behavior is better?
 For example, what is the point of annotating something if that
 something is not visible?
 Also, annotating texts are often placed outside of axes area. I don't
 think clipping out the arrow is a good idea in this case.

 Just in case, this is just a default behavior. You can override this
 behavior without changing the mpl source code.

 Regards,

 -JJ




--
Daniel Hyams
dhy...@gmail.com

--
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Suggestion for annotation arrow clipping

2011-09-11 Thread Daniel Hyams
Mpl 1.0.0

The way Annotation.draw (in text.py) is implemented, if an annotation
is created with an annotation point (x,y) and text located at (tx,ty)
and then the you pan around on the graph such that (x,y) is no longer
visible, the annotation suddenly disappears.

I would suggest the following modification to Annotation.draw in
text.py.  All it does is set a clip box so that the annotation and
arrow is still drawn, but the arrow is clipped at the axes boundary.
It is a much nicer effect than the annotation disappearing.  I have
made this modification in my source locally, and it works very well,
but I thought I would suggest here for inclusion into the main code
base.

Modified lines are marked with a CHANGEME.  It is only a four line change.


@allow_rasterization
def draw(self, renderer):

Draw the :class:`Annotation` object to the given *renderer*.


if renderer is not None:
self._renderer = renderer
if not self.get_visible(): return

xy_pixel = self._get_position_xy(renderer)

#if not self._check_xy(renderer, xy_pixel):   CHANGEME (commented out)
#return
CHANGEME (commented out)


self._update_position_xytext(renderer, xy_pixel)
self.update_bbox_position_size(renderer)


if self.arrow is not None:
if self.arrow.figure is None and self.figure is not None:
self.arrow.figure = self.figure
self.arrow.set_clip_box(self.axes.bbox) # CHANGEME (new line)
self.arrow.draw(renderer)

if self.arrow_patch is not None:
if self.arrow_patch.figure is None and self.figure is not None:
self.arrow_patch.figure = self.figure
self.arrow_patch.set_clip_box(self.axes.bbox)  # CHANGEME (new line)
self.arrow_patch.draw(renderer)

Text.draw(self, renderer)




--
Daniel Hyams
dhy...@gmail.com

--
Using storage to extend the benefits of virtualization and iSCSI
Virtualization increases hardware utilization and delivers a new level of
agility. Learn what those decisions are and how to modernize your storage 
and backup environments for virtualization.
http://www.accelacomm.com/jaw/sfnl/114/51434361/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users