Creating Multiple Legends in Matplotlib
📖 Scenario: You are working on a sales report for two different products over a week. You want to show their sales trends and also highlight their average sales with different styles on the same plot.
🎯 Goal: Build a line plot with two products' daily sales and add two separate legends: one for the sales lines and one for the average sales lines.
📋 What You'll Learn
Create two lists with daily sales data for Product A and Product B.
Create two variables for average sales of Product A and Product B.
Plot daily sales lines for both products.
Plot average sales lines for both products with a different style.
Add two separate legends: one for daily sales lines and one for average sales lines.
💡 Why This Matters
🌍 Real World
Multiple legends help show different groups of information clearly on one chart, like sales trends and averages.
💼 Career
Data scientists and analysts often need to present complex data visually with clear legends to help decision makers understand multiple data aspects.
Progress0 / 4 steps