Horizontal grouped bars
📖 Scenario: You are working for a small company that wants to compare sales of two products across three regions. They want a clear visual to see which product sells better in each region.
🎯 Goal: Create a horizontal grouped bar chart using matplotlib to compare sales of two products across three regions.
📋 What You'll Learn
Create a list called
regions with the values 'North', 'South', and 'East'.Create two lists called
sales_product_a and sales_product_b with sales numbers for each region.Create a variable called
bar_width and set it to 0.4.Use
matplotlib.pyplot to create horizontal grouped bars for both products side by side for each region.Add labels for the y-axis with region names and a legend for the products.
Display the plot.
💡 Why This Matters
🌍 Real World
Horizontal grouped bar charts are useful to compare multiple categories side by side across different groups, such as sales of different products in various regions.
💼 Career
Data analysts and scientists often create grouped bar charts to visualize and communicate comparisons clearly to stakeholders.
Progress0 / 4 steps