Shared axes between subplots
📖 Scenario: You are analyzing sales data for two different products over a week. You want to compare their daily sales side by side using charts that share the same vertical scale to make comparison easier.
🎯 Goal: Create two line charts side by side using matplotlib that share the same y-axis. This will help you visually compare the sales trends of the two products on the same scale.
📋 What You'll Learn
Create a dictionary called
sales_data with daily sales for two products.Create a variable called
days listing the days of the week.Create two subplots side by side that share the y-axis.
Plot sales for each product on its own subplot.
Add titles to each subplot and label the x-axis with days.
💡 Why This Matters
🌍 Real World
Sharing axes between subplots is useful when comparing related data sets visually, such as sales trends, temperature changes, or stock prices over time.
💼 Career
Data scientists and analysts often create shared-axis plots to make comparisons clearer and to present data insights effectively to stakeholders.
Progress0 / 4 steps