Pie chart color customization
📖 Scenario: You are working with sales data for different fruits in a small grocery store. You want to show the sales distribution using a pie chart. To make the chart clearer and more attractive, you want to customize the colors of each slice.
🎯 Goal: Create a pie chart that shows the sales of fruits with custom colors for each fruit slice.
📋 What You'll Learn
Create a dictionary called
fruit_sales with exact fruit names and sales numbers.Create a list called
colors with exact color names matching the fruits order.Use matplotlib's
plt.pie() function with the colors parameter to customize slice colors.Print the pie chart with a title
'Fruit Sales Distribution'.💡 Why This Matters
🌍 Real World
Pie charts are often used in business to show parts of a whole, like sales distribution among products.
💼 Career
Data analysts and scientists use pie charts to communicate data insights clearly to stakeholders.
Progress0 / 4 steps