I see. Note this isn't specific to axhline. For example, in
from matplotlib.matlab import *
dp = 3
the axis setting is also not obeyed because the plot command
autoscales the axes. FYI, I just tested this, and matlab behaves the
In general, I agree it would be nice in some cases to have sticky axis
limits. Probably the easiest and least intrusive way to do this would
be via a setting autoscale(False) or autoscale(True), and you could
set the default via rc. It would be easy in to check this setting in
the autoscale code before doing any work. It would be nice to be able
to access these settings in the axis or xlim/ylim commands
axis(rect, autoscale=False) # autoscaling is off for x and y axis
xlim(lim, autoscale=False) # autoscaling is off for x
and so on.
Whether this is sufficiently useful to justify coding it is an open
On Fri, 08 Oct 2004, John Hunter apparently wrote:
>> Could you send some example code when axis is used first with a
>> description of what looks wrong to you on the plot?
> from scipy import * from matplotlib.matlab import *
> days=arange(31) dp = 3 plot(days,dp*days,'ro') #produce a
> zero axis axis([0,30,-40,100])
> axhline(linewidth=0.5,color=(0,0,0)) show()
> Version is 0.63. Ordered as above: axis is not honored.
> Switch the order of axis() and axhline(), and all is well.