关闭 Seaborn 条形图中的错误条
Turn off error bars in Seaborn Bar Plot
我在 matplotlib 中使用 GridSpec 创建一个包含 9 个子图的页面。其中一个子图是使用以下代码创建的 Seaborn 条形图:
import seaborn as sns
sns.barplot(x=df['Time'], y=df['Volume_Count'], ax=ax7)
有没有办法关闭条形图的垂直误差线?如果不是,是否可以减少条形的水平宽度?
谢谢!
你试过ci
的说法了吗?根据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 的完整示例
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)
通常情况下的输出
输出没有错误条
我在 matplotlib 中使用 GridSpec 创建一个包含 9 个子图的页面。其中一个子图是使用以下代码创建的 Seaborn 条形图:
import seaborn as sns
sns.barplot(x=df['Time'], y=df['Volume_Count'], ax=ax7)
有没有办法关闭条形图的垂直误差线?如果不是,是否可以减少条形的水平宽度?
谢谢!
你试过ci
的说法了吗?根据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 的完整示例
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)