Dual y-axis for different scales
📖 Scenario: You are analyzing sales and profit data for a small store. Sales are in thousands of dollars, and profit is in hundreds of dollars. You want to show both on the same chart but with different y-axis scales.
🎯 Goal: Create a line chart with two y-axes: one for sales and one for profit, so both can be seen clearly despite different scales.
📋 What You'll Learn
Create lists for sales and profit data with exact values
Create a list for months from January to June
Create a plot with two y-axes using matplotlib
Plot sales on the left y-axis and profit on the right y-axis
Label both y-axes and the x-axis
Add a legend to distinguish sales and profit lines
💡 Why This Matters
🌍 Real World
Dual y-axis charts are useful when comparing two related data sets with different units or scales, like sales and profit, temperature and humidity, or stock price and volume.
💼 Career
Data analysts and scientists often need to visualize multiple metrics together to find insights. Knowing how to create dual y-axis plots helps communicate complex data clearly.
Progress0 / 4 steps