简体   繁体   中英

How can I plot the standard error on the error bars in seaborn's barplot?

I have a nice figure that is plotted with generic code as follows:

import seaborn as sns
sns.barplot(data=df, x='X', y='y', hue='HUE', capsize=.1)

The errorbars by default display the 95% confidence interval (I think). Is there a way I can easily change them to standard error?

在此处输入图片说明

ci=68 and SEM is NOT same when the distribution of dataset is non-parametric. Therefore, you cannot calculate SEM with seaborn for now. You shouldn't confuse these especially in scientific papers. (Many physiological phenomena is non-parametric...)

I think this point is strong drawback of seaborn...because most scientific paper use SEM (NOT ci=68). Just do not use seaborn in scientific papers when you want to use SEM! To the best of my knowledge, only way is to use matplotlib or pandas plot sem. https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.sem.html

As simple as this:

import seaborn as sns
sns.barplot(data=df, x='X', y='y', hue='HUE', capsize=.1, ci=68)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM