I do the following imports:
import matplotlib.pyplot as plt
import matplotlib.axes as ax
import matplotlib
import pylab
It properly executes
plt.plot(y1, 'b')
plt.plot(y2, 'r')
plt.grid()
plt.axhline(1, color='black', lw=2)
plt.show()
and shows the graph.
But if I insert
print("ylim=", ax.get_ylim())
I get the error message:
AttributeError: 'module' object has no attribute 'get_ylim'
I have tried replacing ax. with plt., matplotlib, etc., and I get the same error.
What is the proper way to call get_ylim
?
matplotlib.axes
if you're going to usepyplot
orpylab
. If you want to get anAxes
object easily, usefig, ax = plt.subplots()
– Saxhorn