Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: Explain the purpose of the `plt.pie()` function in Matplotlib.
Answer: `plt.pie()` is used to create a pie chart in Matplotlib, representing data in a circular statistical graphic.

Example:

sizes = [20, 30, 40, 10]
labels = ['A', 'B', 'C', 'D']
plt.pie(sizes, labels=labels, autopct='%1.1f%%')
plt.show()
Is it helpful? Yes No

Most helpful rated by users:

©2026 WithoutBook