How to plot a horizontal line in Matplotlib in Python

Plotting a horizontal line in Matplotlib draws a straight line from left to right.

Solution for How to plot a horizontal line in Matplotlib in Python : You can use plt.plot() to plot a horizontal line Call plt.plot(x, y) with x as a sequence of differing x-coordinates and y as a sequence of equal y-coordinates to draw a horizontal line.


how-to-plot-a-horizontal-line-in-matplotlib-in-python