Percentage labels
📖 Scenario: You work in a small bakery and want to show how much each type of pastry contributes to total sales. You want to create a pie chart that shows the percentage share of each pastry type.
🎯 Goal: Create a pie chart using matplotlib that displays the percentage labels for each pastry type's sales.
📋 What You'll Learn
Create a dictionary called
pastry_sales with exact entries for pastry types and their sales numbers.Create a variable called
labels that holds the pastry names from the dictionary.Create a variable called
sizes that holds the sales numbers from the dictionary.Use
matplotlib.pyplot.pie to create a pie chart with percentage labels shown.Print the pie chart to display it.
💡 Why This Matters
🌍 Real World
Pie charts with percentage labels are useful to show parts of a whole in sales reports, surveys, and business presentations.
💼 Career
Data analysts and business intelligence professionals often create pie charts to communicate data insights clearly to stakeholders.
Progress0 / 4 steps