matplotlib / 3.4.3 / _as_gen / matplotlib.axes.axes.hlines.html /

matplotlib.axes.Axes.hlines

Axes. hlines ( y, xmin, xmax, colors=None, linestyles='solid', label='', *, data=None, **kwargs ) [source]

Plot horizontal lines at each y from xmin to xmax.

Parameters:
y float or array-like

y-indexes where to plot the lines.

xmin, xmax float or array-like

Respective beginning and end of each line. If scalars are provided, all lines will have same length.

colors list of colors, default: rcParams["lines.color"] (default: 'C0')
linestyles {'solid', 'dashed', 'dashdot', 'dotted'}, optional
label str, default: ''
Returns:
LineCollection
Other Parameters:
**kwargs LineCollection properties.

See also

vlines
vertical lines
axhline
horizontal line across the Axes

Notes

Note

In addition to the above described arguments, this function can take a data keyword argument. If such a data argument is given, the following arguments can also be string s, which is interpreted as data[s] (unless this raises an exception): y, xmin, xmax, colors.

Objects passed as data must support item access (data[s]) and membership test (s in data).

Examples using matplotlib.axes.Axes.hlines

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