>>>>> "Jeff" == Jeff Peery <jeffpeery@...> writes:
Jeff> I'm plotting a simple xy plot and I'd like to highlight
Jeff> regions that are above a threshold, say for example all
Jeff> points y>=1. The method I am thinking of applying is
Jeff> getting the x,y position of the point that is above the
Jeff> threshold and filling the region between two vertical lines
Jeff> that are right and left of the point with a bright color.
Jeff> I was having some difficulty filling between two vertical
Jeff> lines, I don't think I can use axvline() with fill()?
It sounds like axvspan is what you want
def axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs):
AXVSPAN(xmin, xmax, ymin=0, ymax=1, **kwargs)
axvspan : Axis Vertical Span. xcoords are in data units and y coords
are in axes (relative 0-1) units
Draw a vertical span (regtangle) from xmin to xmax. With the default
values of ymin=0 and ymax=1, this always span the yrange, regardless
of the ylim settings, even if you change them, eg with the ylim
command. That is, the vertical extent is in axes coords: 0=bottom,
0.5=middle, 1.0=top but the y location is in data coordinates.
kwargs are the kwargs to Patch, eg
the terms on the right are aliases
return value is the patches.Polygon instance.
# draw a vertical green translucent rectangle from x=1.25 to 1.55 that
# spans the yrange of the axes
axvspan(1.25, 1.55, facecolor='g', alpha=0.5)
For another approach, see examples/fill*.py, in particular
But if all you want is shading across the vertical extent over an
xrange, axvspan is the function for you,\.