0
0
Matplotlibdata~5 mins

Basic pie chart with plt.pie in Matplotlib - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
APie chart
BBar chart
CLine chart
DScatter plot
Which parameter adds labels to pie chart slices?
Aexplode
Bsizes
Ccolors
Dlabels
How do you show percentage values on pie slices?
AUse <code>labels</code>
BUse <code>autopct</code>
CUse <code>colors</code>
DUse <code>explode</code>
What does plt.axis('equal') do after plotting a pie chart?
AChanges colors
BExplodes slices
CMakes pie circular
DAdds labels
Which of these is NOT a parameter of plt.pie()?
Axlabel
Bsizes
Cautopct
Dlabels
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.