Recall & Review
beginner
What is the purpose of the
plt.pie() function in matplotlib?The
plt.pie() function creates a pie chart, which is a circular graph divided into slices to show proportions of different categories.Click to reveal answer
beginner
Which parameter in
plt.pie() specifies the sizes of each slice?The first parameter, usually a list or array, specifies the sizes (values) of each slice in the pie chart.
Click to reveal answer
beginner
How can you add labels to each slice in a pie chart using
plt.pie()?Use the
labels parameter and pass a list of strings to name each slice.Click to reveal answer
intermediate
What does the
autopct parameter do in plt.pie()?The
autopct parameter formats and displays the percentage value on each slice, e.g., '%.1f%%' shows one decimal place.Click to reveal answer
intermediate
Why is it important to call
plt.axis('equal') after plt.pie()?Calling
plt.axis('equal') makes sure the pie chart is drawn as a circle instead of an ellipse, keeping proportions accurate.Click to reveal answer
What type of chart does
plt.pie() create?✗ Incorrect
plt.pie() creates a pie chart, which shows parts of a whole as slices.
Which parameter adds labels to pie chart slices?
✗ Incorrect
The labels parameter adds names to each slice.
How do you show percentage values on pie slices?
✗ Incorrect
The autopct parameter formats and shows percentages on slices.
What does
plt.axis('equal') do after plotting a pie chart?✗ Incorrect
It ensures the pie chart is a perfect circle, not an ellipse.
Which of these is NOT a parameter of
plt.pie()?✗ Incorrect
xlabel is for axis labels, not used in pie charts.
Explain how to create a basic pie chart using
plt.pie() including how to add labels and percentages.Think about the main inputs needed to show parts of a whole clearly.
You got /4 concepts.
Why is it important to use
plt.axis('equal') after plotting a pie chart?Consider the shape of the pie chart and how it affects visual accuracy.
You got /3 concepts.