mwaskom / seaborn

Statistical data visualization in Python
https://seaborn.pydata.org
BSD 3-Clause "New" or "Revised" License
12.62k stars 1.94k forks source link

Differences when displaying standard deviation on line and barplot #3634

Closed FloskelSalomon closed 9 months ago

FloskelSalomon commented 9 months ago

Hi everyone,

I am currently using the seaborn barplot and want to compute errorbars, which display the standard deviation of my sample. However, when I compare the standard deviation of the same sample in an barplot compared to a lineplot. I see differences (barplot errobars are smaller, e.g., in provided code they lower limit at age 14 only reaches until 20, when in lineplot it goes down until 16.)

Additionally, when I compute the standard deviation with stdev = df.groupby("Age", as_index=False)["Size"].std(). I get the same standard deviations as displayed in the lineplot.

I have provided some more code with my problem here: https://github.com/FloskelSalomon/public_notebooks/blob/main/public_notebooks/problem-with-seaborn-errorbar.ipynb

Could anyone help me out with my problem.

Best, Flo

FloskelSalomon commented 9 months ago

Ok, I just realised that since I installed stannotations yesterday it downgraded seaborn automatically to version < 0.12. I updated seaborn again to the latest version, and the mistake is not happening anymore when using the argument errorbar="sd" instead of ci="sd".