xzeroaxis

Without testing, my guess is that the autoscale magic is getting in
your way. Every plot command calls autoscale, which in the absence of
bugs will include the data but may exceed it. Ie, if you plot data
with a x range from 0.1 to 9.9, it may set the xlim from 0--10.

Thus, although your idea of using the axis return values to get the
min, max is nice, it fails when the autoscale chooses a wider range
for nice ticking. The solution I posted a few minutes ago in which
the span is plotted in *axes* coordinates rather than data coordinates
circumvents this problem.

Cheers!
JDH

ยทยทยท

On Mon, 2004-09-06 at 06:28, Alan G Isaac wrote:

    >> I'm a newbie to Matplotlib but a longtime gnuplot user. Using
    >> the matlab module, what is the right way to set xzeroaxis

    > MATLAB doesn't have anything similar, AFAIK, but the
    > following will work:

    > def xzeroaxis(form='k'): # draw a line at y=0 on the
    > current plot v=axis() plot(v[0:2],[0,0],form)

    > def yzeroaxis(form='k'): v=axis() plot([0,0],v[2:4],form)

    > Is this worth adding to the distribution? I doubt it is
    > general enough to warrant.

    > John: when I do the following: v=arange(-5,5)
    > plot(v,v**3) xzeroaxis() yzeroaxis()

    > the vertical line at x=0 doesn't quite go to top and
    > bottom of the plot. This is with 0.62.4.