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


(a) Normal histograms

(b) Cumulative histograms

(c) Horizontal histograms


Answer :-

(a)


import matplotlib.pyplot as plt
import numpy as np

ndarray = np.arange(1,17,1)

plt.hist(ndarray  )

plt.show()


Output :-



(b)


import matplotlib.pyplot as plt
import numpy as np

ndarray = np.arange(1,17,1)

plt.hist( ndarray , cumulative = True )

plt.show()


Output :-



(c)


import matplotlib.pyplot as plt
import numpy as np

ndarray = np.arange(1,17,1)
plt.hist(ndarray ,orientation="horizontal" )

plt.show()


Output :-



Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post