Version 3.0.3
matplotlib
Fork me on GitHub

matplotlib.axes.Axes.axhspan

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

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 a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha float or None
animated bool
antialiased unknown
capstyle {'butt', 'round', 'projecting'}
clip_box Bbox
clip_on bool
clip_path [(Path, Transform) | Patch | None]
color color
contains callable
edgecolor color or None or 'auto'
facecolor color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle {'miter', 'round', 'bevel'}
label object
linestyle {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth float or None for default
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool or None
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float

See also

axvspan
Add a vertical span across the axes.