Question:

Which of the following statements is used to create a histogram of 'step' type with 20 bins?

Show Hint

Histograms with step-type are useful when you want to visualize the cumulative distribution or the exact bin edges without any filling between the bars.
Updated On: Apr 24, 2025
  • 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())
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

To create a histogram of 'step' type in Matplotlib, we can use the `plt.hist()` function with the argument `histtype = "step"` to get the step-type histogram. The parameter `bins = 20` specifies the number of bins to divide the data into. The correct statement is: \texttt{plt.hist(x, bins = 20, histtype = "step")}.
Was this answer helpful?
0
0