How to fix Matplotlib ' AttributeError: module matplotlib.pyplot' has no attribute 'yrange'

Problem:

You are trying to set the range of the Y axis of a matplotlib plot using code like

plt.yrange([0.0, 10.0])

but you see an error message like this:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-aa38a78ab5d7> in <module>
     12 plt.xscale('log')
     13 plt.grid(True, which="both")
---> 14 plt.yrange([0.0, 70.])
     15

AttributeError: module 'matplotlib.pyplot' has no attribute 'yrange'

Solution

You need to use ylim sinceĀ yrange does not exist! The equivalent call is:

plt.ylim([0.0, 10.0])