Inverted axes
📖 Scenario: You are analyzing sales data for a small store. You want to visualize the sales over a week using a bar chart. To better understand the data, you want to invert the axes so that the days appear on the vertical axis and the sales values on the horizontal axis.
🎯 Goal: Create a bar chart using matplotlib with inverted axes. The days of the week should be on the vertical axis, and the sales numbers on the horizontal axis.
📋 What You'll Learn
Create a dictionary called
sales with days of the week as keys and sales numbers as values.Create a list called
days containing the days of the week in order.Create a list called
values containing the sales numbers in the same order as days.Use
matplotlib.pyplot to create a bar chart with inverted axes.Invert the axes so that days appear on the vertical axis and sales on the horizontal axis.
Display the plot.
💡 Why This Matters
🌍 Real World
Inverting axes is useful when you want to display categories on the vertical axis for better readability, such as days of the week or product names.
💼 Career
Data analysts and scientists often customize plots to make data easier to understand and communicate insights clearly to others.
Progress0 / 4 steps