Page 210 - Robotics and AI class 10
P. 210
Distribution of Schools in Cities
2.00
1.75
1.50
Frequency 1.25
1.00
0.75
0.50
0.25
0.00
15 20 25 30
Number of Schools
Let's draw a histogram to represent marks out of 100 of 40 students in class.
Matplotlib uses a built-in function - hist () to create a histogram.
Example:
from matplotlib import pyplot as plt
import numpy as np
fig,ax = plt.subplots(1,1)
marks = np.array([19,16,28,45,37,34,13,49,42,44])
ax.hist(marks, bins = [10,20,30,40,50])
ax.set_title("histogram of result")
ax.set_xlabel('marks')
ax.set_ylabel('no. of students')
plt.show()
Output:
histogram of result
4.0
3.5
3.0
number of students 2.5
2.0
1.5
1.0
0.5
0.0
10 15 20 25 30 35 40 45 50
marks
208 Touchpad Robotics & Artificial Intelligence-X

