python – AttributeError: module matplotlib has no attribute plot

python – AttributeError: module matplotlib has no attribute plot

Have you installed matplotlib properly? I added an extra line to your code to show the plot. This code works properly in Visual Studio after installing the matplotlib library.

import matplotlib.pyplot as plt 
import numpy as np 

x = np.linspace(-10 , 10, 100)
y = np.sin(x) 
plt.plot(x, y, marker=x)
plt.show()

Try this simple step.

use pyplot using below import statement when importing matplotlib library.

import matplotlib.pyplot as plt

python – AttributeError: module matplotlib has no attribute plot

Leave a Reply

Your email address will not be published.