Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Graph Line Parallel to X Axis in Matplotlib

Tags:

matplotlib

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() 
like image 275
Emily.SageMaker.AWS Avatar asked Apr 12 '15 04:04

Emily.SageMaker.AWS


1 Answers

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.

like image 148
hitzg Avatar answered Nov 09 '22 18:11

hitzg