Vertical Bar Chart with plt.bar
📖 Scenario: You work in a small bakery. You want to show how many cakes you sold each day last week. A simple bar chart will help you see which days were busiest.
🎯 Goal: Create a vertical bar chart using plt.bar to display the number of cakes sold each day of the week.
📋 What You'll Learn
Create a list called
days with the days: 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'.Create a list called
cakes_sold with the exact numbers: 20, 35, 30, 35, 27, 40, 45.Use
plt.bar to make a vertical bar chart with days on the x-axis and cakes_sold on the y-axis.Add labels for the x-axis as 'Days' and y-axis as 'Number of Cakes Sold'.
Add a title 'Cakes Sold Last Week'.
Display the chart with
plt.show().💡 Why This Matters
🌍 Real World
Bar charts are a simple way to show comparisons, like sales over days or months, helping businesses see trends quickly.
💼 Career
Data analysts and scientists often use bar charts to present data clearly to teams and decision makers.
Progress0 / 4 steps