XIIInfo Pract 37
XIIInfo Pract 37
com
Important QnA Histogram for Class 12 IP
Important QnA Histogram for Class 12 IP which is part of Chapter 3 Plotting with Pyplot.
So here we go!
--> Histogram
[2] The numerical data shown by the number of data points that fall within a particular range
is called _______.
--> bins
b) The categories
d) All of these
--> hist()
a) 2
b) 3
c) 4
d) 5
1|Page
Downloaded from www.tutorialaicsip.com
[8] A _______ is a Boolean parameter of hist() function which is by default False.
--> cumulative
--> x
a) x
b) bins
c) histtype
d) orientation
[11] Which of the following parameter have values like horizontal or vertical?
a) x
b) bins
c) histtype
d) orientation
[12] Which of the following is the correct statement to create a histogram with ndarray x and
bins value 30?
a) hist(x,bins:30)
b) hist(x,bins=30)
[]
c) hist(x,bins-30)
d) hist(x,bins,30)
[13] A ________ value should be specified to histtype to generate a lineplot that is by default
unfilled.
--> step
2|Page
Downloaded from www.tutorialaicsip.com
[14]You cannot create horizontal stacked histogram. (True/False)
d) None of these
[3] Clarify the situations when you need to use bar() charts and when you need to use hist()
chart?
[4]What is the significance of the cumulative histogram? Elaborate your answer with an
example.
1. bins
2. histtype
3. orientation
24,17,14,22,25,26,38,42,24,12,28,19,32,21,35,28,21,31,18,19
import matplotlib.pyplot as mp
l=[24,17,14,22,25,26,38,42,24,12,28,19,32,21,35,28,21,31,18,19]
mp.hist(l)
mp.show()
3|Page
Downloaded from www.tutorialaicsip.com
[2] Generate random numbers from 1 to 70 and plot it on the histogram. Change the
outline color to black and the bar color should be yellow.
import matplotlib.pyplot as m
import numpy as np
x=np.random.randn(70)
m.hist(x,20,edgecolor="black",facecolor="yellow")
m.show()
import matplotlib.pyplot as m
import numpy as np
x=np.random.randn(70)
m.hist(x,20,cumulative= True, edgecolor="black",facecolor="yellow")
m.show()
rcb: 78,63,49,41,68,101,56,79,68,96
mi: 45,85,98,102,42,50,43,48,63,39
import matplotlib.pyplot as m
rcb=[78,63,49,41,68,101,56,79,68,96]
mi=[45,85,98,102,42,50,43,48,63,39]
m.hist([rcb,mi],cumulative='true')
m.show()
import matplotlib.pyplot as m
english=[77,66,88,99,55,44,33,79,68,83]
maths=[56,89,70,50,60,65,90,80,47,82]
m.hist([english,maths], orientation='horizontal')
m.show()
4|Page