Area chart with plt.fill_between
📖 Scenario: You are analyzing the sales data of a small shop over a week. You want to visualize how sales changed each day using an area chart. This will help you see the trend clearly.
🎯 Goal: Create an area chart using matplotlib with plt.fill_between to show daily sales over one week.
📋 What You'll Learn
Create a list called
days with the days of the week as strings: 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'.Create a list called
sales with the sales numbers: 150, 200, 180, 220, 170, 210, 190.Use
plt.fill_between to create the area chart with days on the x-axis and sales on the y-axis.Add labels for the x-axis and y-axis, and a title for the chart.
Display the chart using
plt.show().💡 Why This Matters
🌍 Real World
Area charts are useful to show how values change over time or categories, like sales, temperatures, or website visits.
💼 Career
Data analysts and scientists use area charts to communicate trends clearly to teams and decision makers.
Progress0 / 4 steps