plot range affected by axvspan() call

All,

I have stumbled upon a (for me) unexpected behaviour of axvspan().

import matplotlib.pylab as plt
from numpy import *

x = arange(1000)
y = 0.2*sin(0.02*x)

ax = plt.axes()
plt.axvspan(250, 400, facecolor='g', alpha=0.2)
plt.plot(x,y)
plt.show()

The displayed y range is -0.2 to 1, while from the sine amplitude I would have expected -0.2 to 0.2. The expected y range can be obtained by omitting the axvspan() call and also if it is called *after* plot().

Is this the desired behaviour, especially in view of the dependence on the call order?

__version__ is 1.1.0

Cheers,
Joachim

All,

I have stumbled upon a (for me) unexpected behaviour of axvspan().

import matplotlib.pylab as plt
from numpy import *

x = arange(1000)
y = 0.2*sin(0.02*x)

ax = plt.axes()
plt.axvspan(250, 400, facecolor='g', alpha=0.2)
plt.plot(x,y)
plt.show()

The displayed y range is -0.2 to 1, while from the sine amplitude I
would have expected -0.2 to 0.2. The expected y range can be obtained by
omitting the axvspan() call and also if it is called *after* plot().

Is this the desired behaviour, especially in view of the dependence on
the call order?

No, it is a bug.

Eric

ยทยทยท

On 05/17/2011 01:53 AM, Joachim Saul wrote:

__version__ is 1.1.0

Cheers,
Joachim

------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options