Sunday, 10 March 2024

Error: No module named matplotlib.pyplot

While practising the first time we will get this error, without installing the matplotlib

Install using the following command:


pip install matplotlib


Example:

import numpy as np
import matplotlib.pyplot as plt

product_category = np.array(['Furniture', 'Technology', 'Office Supplies'])
sales = np.array ([4110451.90, 4744557.50, 3787492.52] )

plt.bar(product_category, sales)
plt.show()