Rotate your phone or change to desktop for better experience

Rotate your phone or change to desktop for better experience

9. Drawing Histogram and Pie chart using Matplotlib

 from matplotlib import pyplot as plt

import numpy as np

# Histogram chart

marks=[90,50,40,60,55,44,45,10,34,84]

grade_interval=[0,30,50,60,70,90]

plt.title("STUDENT GRADE")

plt.hist(marks,grade_interval)

plt.show()

# Creating dataset using pie chart

cars = ['AUDI', 'BMW', 'FORD','TESLA', 'JAGUAR', 'MERCEDES']

data = [23, 17, 35, 29, 12, 41]

# Creating plot

fig = plt.figure(figsize =(10, 7))

plt.pie(data, labels = cars)

# show plot

plt.show()

Post a Comment

0 Comments