From: John H. <jdh...@ac...> - 2004-10-11 13:52:18
|
>>>>> "Alan" == Alan G Isaac <ai...@am...> writes: Alan> 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? Alan> from scipy import * from matplotlib.matlab import * Alan> days=arange(31) dp = 3 plot(days,dp*days,'ro') #produce a Alan> zero axis axis([0,30,-40,100]) Alan> axhline(linewidth=0.5,color=(0,0,0)) show() Alan> Version is 0.63. Ordered as above: axis is not honored. Alan> Switch the order of axis() and axhline(), and all is well. I see. Note this isn't specific to axhline. For example, in from matplotlib.matlab import * days=arange(31) dp = 3 axis([0,30,-40,100]) plot(days,dp*days,'ro') show() the axis setting is also not obeyed because the plot command autoscales the axes. FYI, I just tested this, and matlab behaves the same way. 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 question. JDH |