You’re looking for axhline
(a horizontal axis line). For example, the following will give you a horizontal line at y = 0.5
:
import matplotlib.pyplot as plt
plt.axhline(y=0.5, color="r", linestyle="-")
plt.show()
More Related Contents:
- Matplotlib scatterplot; color as a function of a third variable
- Set Colorbar Range in matplotlib
- Matplotlib make tick labels font size smaller
- Matplotlib – label each bin
- plot with custom text for x axis points
- Plotting 3D Polygons in python-matplotlib
- How to invert the x or y axis
- scipy: savefig without frames, axes, only content
- How to remove the space between subplots in matplotlib.pyplot?
- Python : 2d contour plot from 3 lists : x, y and rho?
- Plotting a decision boundary separating 2 classes using Matplotlib’s pyplot
- How to change legend size with matplotlib.pyplot
- Changing position of vertical (z) axis of 3D plot (Matplotlib)?
- How to save a Seaborn plot into a file
- Putting arrowheads on vectors in matplotlib’s 3d plot
- Animate points with labels with matplotlib
- Matplotlib – logarithmic scale, but require non-logarithmic labels
- How to set the y-axis limit
- Error in installing Matplotlib : fatal error C1083
- ImportError: Cannot load backend ‘TkAgg’ which requires the ‘tk’ interactive framework, as ‘headless’ is currently running
- Python making combined bar and line plot with secondary y-axis
- Cancelling the offset on an axis [duplicate]
- Memory error while using pip install Matplotlib
- Multiple lines of x tick labels in matplotlib
- Discrete legend in seaborn heatmap plot
- Could not find or load the Qt platform plugin “xcb”
- How do I customize the display of edge labels in networkx?
- Is it possible to add a string as a legend item
- How to add a footnote under the x-axis of a plot
- Converting matplotlib png to base64 for viewing in html template