I have a problem :
Here is the documentation : https://matplotlib.org/stable/gallery/pyplots/axline.html#sphx-glr-gallery-pyplots-axline-py
Here is my code
import matplotlib.pyplot as plt
import numpy as np
for pos in np.linspace(-2, 1, 10):
plt.axline((pos, 0), slope=0.5, color='k', transform=plt.gca().transAxes)
plt.ylim([0, 1])
plt.xlim([0, 1])
plt.show()
Here is the terminal :
Traceback (most recent call last):
File "/home/toto/path/of/the/project/testsubplot.py", line 7, in <module>
plt.axline((pos, 0), slope=0.5, color='k', transform=plt.gca().transAxes)
AttributeError: module 'matplotlib.pyplot' has no attribute 'axline'
I am on Ubuntu 20.1 and I have matplotlib-3.5.1.
Why do I have this error ? I really don't understand why I have AttributeError: module 'matplotlib.pyplot' has no attribute 'axline'. In fact It has the attribute, so why do I have this error ? And how can I fix it ?
!pip install matplotlib --upgrade in google colab this works for me
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With