How to turn off error bars in Seaborn Bar Plot using Matplotlib?

By default, Seaborn bar plots display error bars representing confidence intervals. To turn off these error bars, you can use the ci=None parameter in the barplot() function.

Basic Bar Plot with Error Bars

First, let's create a basic bar plot that shows error bars by default ?

import seaborn as sns
import matplotlib.pyplot as plt

# Load the Titanic dataset
df = sns.load_dataset('titanic')

# Create bar plot with default error bars
plt.figure(figsize=(8, 5))
sns.barplot(x='class', y='age', hue='survived', data=df)
plt.title('Bar Plot with Error Bars (Default)')
plt.show()

Turning Off Error Bars

To remove error bars, set the ci parameter to None ?

import seaborn as sns
import matplotlib.pyplot as plt

# Load the Titanic dataset
df = sns.load_dataset('titanic')

# Create bar plot without error bars
plt.figure(figsize=(8, 5))
sns.barplot(x='class', y='age', hue='survived', data=df, ci=None)
plt.title('Bar Plot without Error Bars')
plt.show()

Alternative Methods

You can also use errorbar=None in newer versions of Seaborn ?

import seaborn as sns
import matplotlib.pyplot as plt

# Load the Titanic dataset
df = sns.load_dataset('titanic')

# Using errorbar parameter (Seaborn v0.12+)
plt.figure(figsize=(8, 5))
sns.barplot(x='class', y='age', hue='survived', data=df, errorbar=None)
plt.title('Bar Plot using errorbar=None')
plt.show()

Comparison

Parameter Seaborn Version Effect
ci=None All versions Removes confidence interval bars
errorbar=None v0.12+ Removes error bars (newer syntax)
ci=95 All versions Shows 95% confidence intervals

Conclusion

Use ci=None to turn off error bars in Seaborn bar plots. For newer Seaborn versions, you can also use errorbar=None for the same effect.

Updated on: 2026-03-25T20:08:57+05:30

968 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements