xzeroaxis

So while we're generalizing let me dream. Focus on the case

    > of vertical lines. The ideal functionality would allow me
    > to use 'vlines' with a special value to indicate ymin and
    > ymax. Ideally this same 'special values' convention would
    > extend to 'fill' (or maybe 'bar'), since I often need event
    > shading. Perhaps the obvious special value is None?

We encourage dreaming around here (TM)

I made a number of simple but useful additions to the matlab interface
based on your (and others') many suggestions. I also updated the html
docs to include links to the these funcs. They aren't on the web site
yet, but will be with the next release.

xlim, ylim #set or get the xlimits
    ymin, ymax = ylim() : return the current ylim
    ylim( (ymin, ymax) ) : set the ylim to ymin, ymax
    ylim( ymin, ymax ) : set the ylim to ymin, ymax

xticks, yticks # set or get the xtick locs and labels.
    locs, labels = xticks()

    # set the locations of the xticks
    xticks( arange(6) )

    # set the locations and labels of the xticks
    xticks( arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue') )

axhline: # draw horizontal lines that span the xrange; analog is axyline
    # all y coords in these examples are data units, all x coords are
    # relative axes units

    # equivalent to xzeroaxis
    axhline()

    # draw a thick red hline at y=0 that spans the xrange
    l = axhline(linewidth=4, color='r')

    # draw a default hline at y=1 that spans the xrange
    l = axhline(y=1)

    # draw a default hline at y=2 that spans the the middle half of
    # the xrange
    l = axhline(y=2, xmin=0.25, xmax=0.75)

axhspan: draw horizontal bar that spans xrange; analog is axvspan

    # draws a gray rectangle from y=0.25-0.75 that spans the horizontal
    # extent of the axes
    p = axhspan(0.25, 0.75, facecolor=0.5, alpha=0.5)

The axhline/axvline/axhspan/axvspan all span the respective dimension
of the axis by default, but this can be controlled with optional args.

Here is a screenshot from a demo script

  http://nitace.bsd.uchicago.edu:8080/files/share/spans.png

The test script itself

test.py (844 Bytes)

matlab.py (51.4 KB)

Very useful!!
And very cool as well.
Thanks,
Alan

···

On Thu, 09 Sep 2004, John Hunter apparently wrote:

I made a number of simple but useful additions to the matlab interface

Just for context, there is much I can do with Matplotlib
that I cannot do in gnuplot, and vice versa. Naturally I
want the best of both worlds ...

In gnuplot, I can
set xtics axis
to put the tics (both the tics themselves and the
accompanying labels) along the zeroaxis (If the zeroaxis is
very close to the border, the axis option will move the tic
labels to outside the border.)

Now that you have given us axhline as a generalization of
gnuplot's
set xzeroaxis
please consider letting xticks take an optional "loc"
argument, which could either be "border" or a number to be
interpreted as a 'y' value.

So, e.g.,
axhline()
xticks(arange(5),loc=0)
would draw an xzeroaxis and
put the xtics along it.

Am I overlooking an obvious way to do this (in the
matlab module)?

fwiw,
Alan

···

On Thu, 09 Sep 2004, John Hunter apparently wrote:

    # set the locations of the xticks
    xticks( arange(6) )

    # set the locations and labels of the xticks
    xticks( arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue') )