Add a horizontal line spanning the whole or fraction of the Axes.
Note: If you want to set x-limits in data coordinates, use hlines
instead.
y position in data coordinates.
The start x-position in axes coordinates. Should be between 0 and 1, 0 being the far left of the plot, 1 the far right of the plot.
The end x-position in axes coordinates. Should be between 0 and 1, 0 being the far left of the plot, 1 the far right of the plot.
Line2D
A Line2D
specified via two points (xmin, y)
, (xmax, y)
. Its transform is set such that x is in axes coordinates and y is in data coordinates.
This is still a generic line and the horizontal character is only realized through using identical y values for both points. Thus, if you want to change the y value later, you have to provide two values line.set_ydata([3, 3])
.
Valid keyword arguments are Line2D
properties, except for 'transform':
See also
hlines
Add horizontal lines in data coordinates.
axhspan
Add a horizontal span (rectangle) across the axis.
axline
Add a line with an arbitrary slope.
Notes
Examples
draw a thick red hline at 'y' = 0 that spans the xrange:
>>> axhline(linewidth=4, color='r')
draw a default hline at 'y' = 1 that spans the xrange:
draw a default hline at 'y' = .5 that spans the middle half of the xrange:
>>> axhline(y=.5, xmin=0.25, xmax=0.75)
matplotlib.pyplot.axhline
#
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4