Reputation: 332
I'm thinking this is extremely simple. I would like to graph the line y = 7.87. This graphs a line parallel to the y-axis, but I'm looking for something horizontal, parallel with x-axis. Any ideas?
import matplotlib.pyplot as plt
plt.axvline(x = 7.85)
plt.show()
Upvotes: 9
Views: 13735
Reputation: 12691
It really is quite simple:
import matplotlib.pyplot as plt
plt.axhline(y=7.87)
plt.show()
The h
and v
in the function names (axhline
and axvline
) stand for horizontal and vertical.
Upvotes: 17