I just remembered that there has been a bug in old version of matplotlib that annotation_clip parameter is not correctly set when given as a keyword parameter of "annotate" function. The bug has been fixed.
http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg15068.html As a workaround, use ann = pylab.annotate('',(-1,3.1),(0,3.1),va='center',ha='center', arrowprops=dict(arrowstyle='<->')) ann.set_annotation_clip(False) Regards, -JJ On Sun, Aug 29, 2010 at 5:59 AM, Stan Schymanski <ssc...@bgc-jena.mpg.de> wrote: > Hi JJ, > > Thanks for the advice. However, the annotation_clip=False addition does not > make a difference to me. I am using Matplotlib from within Sage, though; not > sure if this makes it behave differently. > > Cheers > Stan > > On 8/28/10 5:09 PM, Jae-Joon Lee wrote: >> >> I think this change has been there for a while. >> For recent versions of matplotlib, the default behavior of annotate is >> that, when xycoords=="data", the arrow is drawn only when the >> annotated point is inside the axes. >> To override this behavior, use annotation_clip keyword parameter. >> >> >> pylab.annotate('',(-1,3.1),(0,3.1),va='center',ha='center', >> arrowprops=dict(arrowstyle='<->'), annotation_clip=False) >> >> Regards, >> >> -JJ >> >> >> On Fri, Aug 27, 2010 at 9:21 PM, Stan Schymanski<ssc...@bgc-jena.mpg.de> >> wrote: >> >>> >>> Dear all, >>> >>> I don't know which update it was that broke it, but this used to work: >>> >>> import numpy >>> import pylab >>> pylab.clf() >>> fig = pylab.figure(1,figsize=(8,5)) >>> ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1,5), >>> ylim=(-4,3)) >>> >>> t = numpy.arange(0.0, 5.0, 0.01) >>> s = numpy.cos(2*numpy.pi*t) >>> line, = ax.plot(t, s, lw=3, color='purple') >>> pylab.text(-0.5,3.2,'no data',ha='center') >>> >>> pylab.annotate('',(-1,3.1),(0,3.1),va='center',ha='center',arrowprops=dict(arrowstyle='<->')) >>> pylab.savefig('blah.png') >>> >>> This used to plot an arrow under the text 'no data' but above the main >>> plot. Now this arrow does not appear unless at least part of it is within >>> the plotting area. Change one of the '3.1' in the code above to, say, 3.0 >>> and the whole arrow is displayed. Is this a bug or is there a new way of >>> achieving what I want? >>> >>> Thanks for your help already! >>> >>> Cheers >>> Stan >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Sell apps to millions through the Intel(R) Atom(Tm) Developer Program >>> Be part of this innovative community and reach millions of netbook users >>> worldwide. Take advantage of special opportunities to increase revenue >>> and >>> speed time-to-market. Join now, and jumpstart your future. >>> http://p.sf.net/sfu/intel-atom-d2d >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Matplotlib-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >>> > > -- > ________________________________________ > > Stan Schymanski > Scientist > Max Planck Institute for Biogeochemistry > PO Box 10 01 64 > D-07701 Jena, Germany > > Phone: +49.3641.576264 > Fax: +49.3641.577274 > WWW: http://www.bgc-jena.mpg.de/~sschym > > Biospheric Theory and Modelling Group > http://www.bgc-jena.mpg.de/bgc-theory/ > _________________________________________ > > ------------------------------------------------------------------------------ Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users