Complete the code to import the matplotlib plotting module.
import [1] as plt
We import the plotting module from matplotlib as plt to create charts.
Complete the code to create a pie chart from the data list.
data = [30, 20, 50] plt.[1](data) plt.show()
The pie function creates a pie chart from the data.
Fix the error in the code to label the pie chart slices.
sizes = [40, 35, 25] labels = ['A', 'B', 'C'] plt.pie(sizes, labels=[1]) plt.show()
The labels parameter should be set to the variable holding the labels list.
Fill both blanks to create a pie chart with percentages and a title.
sizes = [10, 20, 70] labels = ['X', 'Y', 'Z'] plt.pie(sizes, labels=[1], autopct=[2]) plt.title('My Pie Chart') plt.show()
Use the labels variable for labels and '%1.1f%%' to show percentages with one decimal.
Fill all three blanks to create a pie chart with labels, explode effect, and shadow.
sizes = [15, 30, 55] labels = ['Red', 'Blue', 'Green'] explode = ([1], [2], [3]) plt.pie(sizes, labels=labels, explode=explode, shadow=True) plt.show()
The explode tuple offsets the first slice by 0.1 and leaves others unchanged with 0.
