Informatics Practices
Which of the following statements is used to create a histogram of 'step' type with 20 bins?
- plt.hist(x, bins = 20, histtype = "barstacked")
- plt.hist(x, bins=20)
- plt.hist(x, bins=20, histtype="step")
- plt.hist(x, bins=20, histtype=hist())
PyPlot
1 Like
Answer
plt.hist(x, bins=20, histtype="step")
Reason — The histtype parameter in the hist() function is used to specify the type of histogram to be created. In this case, histtype="step" is used to create a step histogram. The bins=20 parameter specifies that the histogram should be divided into 20 bins. Hence, the correct statement is plt.hist(x, bins=20, histtype="step").
Answered By
3 Likes
Related Questions
Which of the following commands is used to install Matplotlib for coding?
- import plt.matplotlib as plot
- import plot.matplotlib as pt
- import matplotlib.plt as plot
- import matplotlib.pyplot as plt
Which of the following methods should be employed in the code to display a plot()?
- show()
- display()
- execute()
- plot()
The part of chart which identifies different sets of data plotted on plot by using different colors is called:
- legends
- title
- axes
- figure
Which of the following is an incorrect example of savefig() function?
- plt.savefig("bar1.pdf" )
- plt.savefig("bar1.png")
- plt.savefig("bar1.eps")
- plt.savefig("bar1.ppt")