Matplotlib: 'AttributeError: module matplotlib.pyplot has no attribute yrange' beheben
English
Deutsch
Problem:
Sie versuchen, den Bereich der Y-Achse eines matplotlib-Plots mit Code wie
matplotlib_ylim_example.py
plt.yrange([0.0, 10.0])festzulegen, erhalten aber eine Fehlermeldung wie diese:
matplotlib_yrange_error.txt
---------------------------------------------------------------------------
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'Lösung
Sie müssen ylim verwenden, da yrange nicht existiert! Der entsprechende Aufruf ist:
matplotlib_ylim_fix.py
plt.ylim([0.0, 10.0])Check out similar posts by category:
Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow