CBSE Class 12 Informatics Practices Question 139 of 147

Plotting with Pyplot — Question 22

Back to all questions
22
Question

Question 14(b)

Create an ndarray containing 16 values and then plot this array along with dataset of previous question in same histogram, cumulative histograms.

Answer
import numpy as np
import matplotlib.pyplot as plt
weights = [78, 72, 69, 81, 63, 67, 65, 75, 79, 74, 71, 83, 71, 79, 80, 69]
random_array = np.arange(16) 
plt.hist(weights, cumulative = True)
plt.hist(random_array, cumulative = True)
plt.title('Cumulative Histograms')
plt.show()
Output
Create an ndarray containing 16 values and then plot this array along with dataset of previous question in same histogram, cumulative histograms. Plotting with Pyplot, Informatics Practices Computer Science Sumita Arora Solutions CBSE Class 12