Heatmap with plt.imshow
📖 Scenario: You work in a small bakery that tracks daily sales of different types of bread. You want to visualize the sales data to see which bread types sell best on which days.
🎯 Goal: Create a heatmap using plt.imshow to visualize the sales of bread types over a week.
📋 What You'll Learn
Create a 2D list called
sales with exact sales numbers for 3 bread types over 4 days.Create a list called
days with the names of the 4 days.Create a list called
bread_types with the names of the 3 bread types.Use
plt.imshow to create a heatmap of the sales data.Add x-axis labels using
days and y-axis labels using bread_types.Add a color bar to show the scale of sales.
💡 Why This Matters
🌍 Real World
Heatmaps are used in many fields like sales analysis, weather data, and biology to quickly see patterns and differences in data.
💼 Career
Knowing how to create heatmaps helps data analysts and scientists communicate complex data visually to teams and decision makers.
Progress0 / 4 steps