matplotlib.axes.Axes.axhspan

Axes.axhspan(self, 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:
yminfloat

Lower limit of the horizontal span in data units.

ymaxfloat

Upper limit of the horizontal span in data units.

xminfloat, optional, default: 0

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

xmaxfloat, optional, default: 1

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

Returns:
PolygonPolygon
Other Parameters:
**kwargsPolygon 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 or aa unknown
capstyle {'butt', 'round', 'projecting'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
contains callable
edgecolor or ec color or None or 'auto'
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
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.

Examples using matplotlib.axes.Axes.axhspan

© 2012–2018 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.2.2/api/_as_gen/matplotlib.axes.Axes.axhspan.html