Thursday, May 2, 2024

BCA PART B 9. Drawing Histogram and Pie chart using Matplotlib

 


import matplotlib.pyplot as plt
import numpy as np
y = np.random.normal(170, 10, 250)
plt.hist(y)
plt.show()

x = [64.73,18.43,3.37,3.36,10.11]
labels = ['Chrome', 'Safari', 'Edge', 'Firefox', 'Others']
plt.pie(x, labels=labels,autopct='%.1f%%')
plt.show()

No comments:

Post a Comment