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
dhyams@...287...