Legend placement and styling
📖 Scenario: You are creating a simple line chart to compare sales data for two products over four quarters. You want to add a legend to clearly show which line belongs to which product. You will place the legend in a specific location and style it to make the chart easy to understand.
🎯 Goal: Build a line chart with two product sales lines, add a legend with labels, place the legend at the upper left corner, and style the legend with a shadow and a fancy box.
📋 What You'll Learn
Create two lists of sales data for Product A and Product B for four quarters.
Create a list of quarter labels for the x-axis.
Plot both sales lines with labels for the legend.
Add a legend placed at the upper left corner.
Style the legend with a shadow and a fancy box.
Display the plot.
💡 Why This Matters
🌍 Real World
Legends help viewers understand which data lines or points represent which categories in charts, making reports and presentations clearer.
💼 Career
Data scientists and analysts often need to create clear visualizations with legends to communicate insights effectively to stakeholders.
Progress0 / 4 steps