Stacked Area Chart
📖 Scenario: You work as a data analyst for a small company. You have sales data for three products over four quarters. Your manager wants to see how the total sales and individual product sales changed over time in a clear visual format.
🎯 Goal: Create a stacked area chart using matplotlib to show the sales trends of three products over four quarters.
📋 What You'll Learn
Create a dictionary called
sales_data with keys 'Q1', 'Q2', 'Q3', 'Q4' and values as lists of sales numbers for three products.Create a list called
quarters with the values 'Q1', 'Q2', 'Q3', 'Q4'.Use
matplotlib.pyplot to create a stacked area chart.Label the x-axis as
'Quarter' and y-axis as 'Sales'.Add a legend with product names
'Product A', 'Product B', and 'Product C'.💡 Why This Matters
🌍 Real World
Stacked area charts are useful to visualize how different parts contribute to a whole over time, such as sales of multiple products across quarters.
💼 Career
Data analysts and scientists often create stacked area charts to present trends and comparisons clearly to stakeholders.
Progress0 / 4 steps