Thanks! As far as I can tell, this works perfectly.

I agree that this should probably be the default behaviour.

Ben

On Thu, May 14, 2009 at 8:03 PM, Jae-Joon Lee <lee.j.j...@gmail.com> wrote:
> On Thu, May 14, 2009 at 4:36 AM, Ben Coppin <cop...@gmail.com> wrote:
>> Hi,
>>
>> I've added annotations to a graph I am producing using matplotlib. The
>> annotations work fine, but when you zoom and pan, the annotations move off
>> the edge of the chart and are still visible while they're in the main TK
>> window. Does anyone know of a way to make the annotations disappear when
>> they move off the edge of the chart?
>
> Currently, there is no support for this. However, a monkey patching
> can be a quick solution for now.
>
>
> from matplotlib.text import Annotation
>
> def draw(self, renderer):
>    x, y = self.xy
>    x, y = self._get_xy(x, y, self.xycoords)
>    if not self.axes.bbox.contains(x, y):
>        return
>
>    self.draw_real(renderer)
>
> Annotation.draw_real = Annotation.draw
> Annotation.draw = draw
>
> ann = annotate("test", (0.5, 0.5), xytext=(0.6, 0.6),
>               arrowprops=dict(arrowstyle="->"))
>
>
> I think this should be the default behavior (with optionally turned
> off). If other developers don't object, i'll try to push this feature
> into the svn.
>
> Regards,
>
> -JJ
>
>
>>
>> Thanks,
>>
>> Ben
>>
>> ------------------------------------------------------------------------------
>> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
>> production scanning environment may not be a perfect world - but thanks to
>> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK
>> i700
>> Series Scanner you'll get full speed at 300 dpi even with all image
>> processing features enabled. http://p.sf.net/sfu/kodak-com
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to