As a Python developer with over seven years of experience working extensively with Matplotlib and Pandas, I understand the importance of clear and insightful data visualization.
One of the most effective ways to compare multiple categories across different groups is by using multiple bar charts. In this article, I will walk you through several practical methods to create multiple bar charts in Python using Pandas and Matplotlib.
Whether you’re analyzing sales data across U.S. states or comparing monthly revenue for different products, mastering multiple bar charts will elevate your data storytelling skills.
Use Multiple Bar Charts in Python
Multiple bar charts allow you to visually compare two or more sets of data side by side. For example, if you want to compare quarterly sales of three different products across several states, multiple bar charts provide an intuitive way to see trends and differences at a glance.
Using Pandas together with Matplotlib makes this task straightforward. Pandas helps manage your data, while Matplotlib handles the plotting. This combination is powerful, especially when working with real-world datasets from the USA, such as state-wise sales, population statistics, or economic indicators.
Prepare Your Data in Pandas
Before plotting, you need a well-structured dataset. Let me show you a sample dataset that compares quarterly sales of three products across four U.S. states.
import pandas as pd
# Sample sales data for Q1 2025
data = {
'State': ['California', 'Texas', 'New York', 'Florida'],
'Product A': [25000, 18000, 22000, 21000],
'Product B': [20000, 16000, 21000, 19000],
'Product C': [15000, 14000, 18000, 17000]
}
df = pd.DataFrame(data)
print(df)This simple DataFrame shows sales figures for three products in four states. The next step is to visualize this data with multiple bar charts.
Method 1: Use Pandas Built-In Plot Function
Pandas has a built-in .plot() function that integrates directly with Matplotlib. It makes creating multiple bar charts very simple.
import matplotlib.pyplot as plt
# Set 'State' as the index to plot bars for each state
df.set_index('State', inplace=True)
# Plot multiple bar chart
df.plot(kind='bar', figsize=(10, 6))
plt.title('Quarterly Sales by Product and State (Q1 2025)')
plt.xlabel('State')
plt.ylabel('Sales in USD')
plt.xticks(rotation=45)
plt.legend(title='Products')
plt.tight_layout()
plt.show()I executed the above example code and added the screenshot below.

This method is my go-to when I need a quick visualization with minimal customization. The bars for each product appear side by side for each state, making comparisons easy.
Method 2: Use Matplotlib for More Customization
Sometimes, you need more control over your charts. Matplotlib allows you to customize colors, bar widths, and annotations.
import numpy as np
states = df.index.tolist()
products = df.columns.tolist()
num_states = len(states)
num_products = len(products)
# Position of bars on x-axis
bar_width = 0.2
r = np.arange(num_states)
plt.figure(figsize=(12, 7))
for i, product in enumerate(products):
plt.bar(r + i * bar_width, df[product], width=bar_width, label=product)
plt.xlabel('State')
plt.ylabel('Sales in USD')
plt.title('Quarterly Sales by Product and State (Q1 2025)')
plt.xticks(r + bar_width, states, rotation=45)
plt.legend()
plt.tight_layout()
plt.show()I executed the above example code and added the screenshot below.

With this approach, I can adjust bar widths, colors, and positions precisely. It’s perfect for presentations where visual clarity matters.
Method 3: Create Grouped Bar Charts with Seaborn (Optional)
If you’re looking for an alternative to Matplotlib, Seaborn streamlines the process and adds aesthetic appeal.
import seaborn as sns
# Reset index for seaborn compatibility
df_reset = df.reset_index()
# Convert data to long format for seaborn
df_melt = pd.melt(df_reset, id_vars=['State'], var_name='Product', value_name='Sales')
plt.figure(figsize=(12, 7))
sns.barplot(x='State', y='Sales', hue='Product', data=df_melt)
plt.title('Quarterly Sales by Product and State (Q1 2025)')
plt.xlabel('State')
plt.ylabel('Sales in USD')
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()I executed the above example code and added the screenshot below.

Seaborn’s syntax is concise, and it automatically manages colors and legends, which I find very useful for quick exploratory data analysis.
Tips for Effective Multiple Bar Charts in Python
- Keep labels readable: Rotate x-axis labels if they overlap.
- Use legends wisely: Clearly label each product or category.
- Choose contrasting colors: This helps distinguish bars easily.
- Add data labels: Annotate bars for quick value reference.
- Maintain consistent bar widths and spacing: Ensures visual balance.
Creating multiple bar charts in Python using Pandas and Matplotlib is straightforward once you understand the basics. Whether you use Pandas’ built-in plotting, Matplotlib’s flexible interface, or Seaborn’s elegant style, you can efficiently visualize complex datasets.
From my experience working with USA-based sales data and other business metrics, these methods help communicate insights clearly and effectively. I encourage you to experiment with these techniques on your own datasets to find the style that best fits your needs.
You may also read:
- Set Xlim and Zlim in Matplotlib 3D Scatter Plot
- Create 3D Scatter Plot from a NumPy Array in Matplotlib
- Change View Angle in Matplotlib 3D Scatter Plot in Python
- Use Depthshade in Matplotlib 3D Scatter Plots

I am Bijay Kumar, a Microsoft MVP in SharePoint. Apart from SharePoint, I started working on Python, Machine learning, and artificial intelligence for the last 5 years. During this time I got expertise in various Python libraries also like Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… for various clients in the United States, Canada, the United Kingdom, Australia, New Zealand, etc. Check out my profile.