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)