Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: How can you create a histogram in Matplotlib?
Answer: Use the `plt.hist()` function to create a histogram in Matplotlib.

Example:

data = [1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 4, 5]
plt.hist(data, bins=5, edgecolor='black')
plt.show()
Is it helpful? Yes No

Most helpful rated by users:

©2026 WithoutBook