Data Science
Bar Charts: Comparing Categories
SQL Mastery Team
May 29, 2026
5 min read
Welcome to **Day 128**. If the Line Chart is for "Time," the Bar Chart is for "Categories."
Vertical vs Horizontal
The Code
categories = ['Electronics', 'Clothing', 'Home']
counts = [450, 600, 300]
plt.bar(categories, counts, color=['red', 'blue', 'green'])
plt.title("Orders per Category")
plt.show()
Grouped Bar Charts
Sometimes you want to compare categories *across another category* (e.g., Sales per region in 2023 vs 2024). This is where libraries like **Seaborn** start to shine!
Your Task for Today
Create a horizontal bar chart showing your 5 favorite movies and their IMDB ratings.
*Day 129: Histograms: Seeing the Distribution.*