[Matplotlib-users] plotting an arrow outside of the plot does not work any more

I wonder if it was one of the fixes to the clipping code. If I plot this to the screen and then move the plot so that the “no data” text is in the plot area, the arrow shows up.

So, the question is… was plotting arrows outside the plot area a bug or a feature? And, if it was a bug, what about being able to annotate outside the plot area?

Lastly, whatever the outcome, this example should probably become a test because it would be a great way to test for obscure broken behavior.

Ben Root

P.S. - cc’ing the devel mailing list here…

···

On Fri, Aug 27, 2010 at 7:21 AM, Stan Schymanski <sschym@…881…> 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(2numpy.pit)

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