Bar Plots in Pandas & Seaborn – Best Practices for Categorical Data 2026
Bar plots are one of the most effective ways to visualize and compare categorical data. In 2026, combining Pandas’ simple .plot(kind="bar") with Seaborn’s barplot() and countplot() gives you both quick insights and publication-quality visualizations.
TL;DR — When to Use Which Bar Plot
df.plot(kind="bar")– Quick bar chart from Pandassns.barplot()– Statistical bar plots with confidence intervalssns.countplot()– Simple frequency counts
1. Basic Bar Plot with Pandas
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("sales_data.csv")
# Total sales by region
sales_by_region = df.groupby("region")["amount"].sum()
sales_by_region.plot(
kind="bar",
figsize=(10, 6),
color="skyblue",
edgecolor="black"
)
plt.title("Total Sales by Region")
plt.ylabel("Sales Amount")
plt.xlabel("Region")
plt.xticks(rotation=0)
plt.show()
2. Professional Bar Plots with Seaborn
import seaborn as sns
plt.figure(figsize=(10, 6))
# Bar plot with mean and confidence interval
sns.barplot(
data=df,
x="region",
y="amount",
estimator="sum", # or "mean", "median", etc.
ci=95, # 95% confidence interval
palette="Blues_d"
)
plt.title("Total Sales by Region with Confidence Intervals")
plt.ylabel("Total Sales Amount")
plt.show()
3. Count Plot vs Bar Plot
# Count of transactions by category
plt.figure(figsize=(10, 6))
sns.countplot(
data=df,
x="category",
order=df["category"].value_counts().index
)
plt.title("Number of Transactions by Category")
plt.xticks(rotation=45)
plt.show()
# Average sales by category
plt.figure(figsize=(10, 6))
sns.barplot(
data=df,
x="category",
y="amount",
estimator="mean"
)
plt.title("Average Sales Amount by Category")
plt.show()
4. Best Practices in 2026
- Use
sns.barplot()when you need statistical estimates and confidence intervals - Use
df.plot(kind="bar")for very quick exploratory plots - Use
sns.countplot()when you want to show frequencies/counts - Always sort categories by value using
order=or.sort_values() - Rotate x-labels with
plt.xticks(rotation=45)when labels are long - Use meaningful color palettes (e.g., `"Blues_d"`, `"viridis"`, `"Set2"`)
Conclusion
Bar plots are excellent for comparing categories and showing totals or averages. In 2026, start with Pandas .plot(kind="bar") for quick checks, then switch to Seaborn’s barplot() and countplot() for more insightful and visually appealing results. Always sort your categories and add clear titles and labels to make your bar plots truly effective for analysis and presentation.
Next steps:
- Create bar plots showing total sales and average sales by region and by category from your current dataset