41
import seaborn as sns

# sample data
df = sns.load_dataset('titanic')

ax = sns.barplot(data=df, x='class', y='age', hue='survived')

enter image description here

Is there a way to turn off the black error bars?

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
equanimity
  • 2,371
  • 3
  • 29
  • 53

3 Answers3

70

Have you tried the ci argument? According to the documentation:

ci : float or None, optional Size of confidence intervals to draw around estimated values. If None, no bootstrapping will be performed, and error bars will not be drawn.

sns.barplot(x=df['Time'], y=df['Volume_Count'], ax=ax7, ci=None)
Diziet Asahi
  • 38,379
  • 7
  • 60
  • 75
  • For others coming to this answer, `ci` is now depreciated (as of seaborne version 0.12.0). You should now use `errorbar` as suggested by derekchased – Pegasaurus Jul 26 '23 at 20:00
12

Complete example for @Diziet Asahi

import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

df = sns.load_dataset('titanic')

# Usual case
sns.barplot(x='class', y='age', hue='survived', data=df)

# No error bars (ci=None)
sns.barplot(x='class', y='age', hue='survived', data=df, ci=None)

Output for Usual case

enter image description here

Output No error bars

enter image description here

petezurich
  • 9,280
  • 9
  • 43
  • 57
BhishanPoudel
  • 15,974
  • 21
  • 108
  • 169
5
  • The errorbar parameter should be used instead.
  • The ci parameter is deprecated from seaborn 0.12.0, as per v0.12.0 (September 2022): More flexible errorbars. This applies to the following plots:
    • seaborn.barplot, and sns.catplot with kind='bar'
    • seaborn.lineplot, and sns.relplot with kind='line'
      • g = sns.relplot(data=df, kind='line', x='class', y='age', hue='survived', col='sex', errorbar=None)
      • ax = sns.lineplot(data=df, x='class', y='age', hue='survived', errorbar=None)
    • seaborn.pointplot, and sns.catplot with kind='point'
      • g = sns.catplot(data=df, kind='point', x='class', y='age', hue='survived', col='sex', errorbar=None)
      • ax = sns.pointplot(data=df, x='class', y='age', hue='survived', errorbar=None)
import seaborn as sns

df = sns.load_dataset('titanic')

ax = sns.barplot(data=df, x='class', y='age', hue='survived', errorbar=None)

enter image description here

g = sns.catplot(data=df, kind='bar', x='class', y='age', hue='survived', col='sex', errorbar=None)

enter image description here

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
derekchased
  • 66
  • 1
  • 3