matplotlib

Travis-CI:

This Page

matplotlib.axes.Axes.axhspan

Axes.axhspan(ymin, ymax, xmin=0, xmax=1, **kwargs)

Add a horizontal span (rectangle) across the axis.

Draw a horizontal span (rectangle) from ymin to ymax. With the default values of xmin = 0 and xmax = 1, this always spans the xrange, regardless of the xlim settings, even if you change them, e.g., with the set_xlim() command. That is, the horizontal extent is in axes coords: 0=left, 0.5=middle, 1.0=right but the y location is in data coordinates.

Parameters:

ymin : float

Lower limit of the horizontal span in data units.

ymax : float

Upper limit of the horizontal span in data units.

xmin : float, optional, default: 0

Lower limit of the vertical span in axes (relative 0-1) units.

xmax : float, optional, default: 1

Upper limit of the vertical span in axes (relative 0-1) units.

Returns:

Polygon : Polygon

Other Parameters:
 

kwargs : Polygon properties.

Property Description
agg_filter unknown
alpha float or None
animated [True | False]
antialiased or aa [True | False] or None for default
axes an Axes instance
capstyle [‘butt’ | ‘round’ | ‘projecting’]
clip_box a matplotlib.transforms.Bbox instance
clip_on [True | False]
clip_path [ (Path, Transform) | Patch | None ]
color matplotlib color spec
contains a callable function
edgecolor or ec mpl color spec, None, ‘none’, or ‘auto’
facecolor or fc mpl color spec, or None for default, or ‘none’ for no color
figure a matplotlib.figure.Figure instance
fill [True | False]
gid an id string
hatch [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle [‘miter’ | ‘round’ | ‘bevel’]
label string or anything printable with ‘%s’ conversion.
linestyle or ls [‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lw float or None for default
path_effects unknown
picker [None|float|boolean|callable]
rasterized [True | False | None]
sketch_params unknown
snap unknown
transform Transform instance
url a url string
visible [True | False]
zorder any number

See also

axvspan
Add a vertical span (rectangle) across the axes.

Examples

(Source code, png, pdf)

../../_images/axhspan_demo.png