-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
custom error bars for factorplot/bar plot? #question #enhancement #331
Comments
This isn't functionality that is currently possible to do in any easy way, and it would be enough of a departure from the way things currently work that it isn't likely to be added any time soon. Of course, there is |
Ah, that's what I suspected. I have tried plt.errorbar and plt.bar... the truth is, I hate Anyway thanks for the fast reply! I really like seaborn. Sam
|
Just out of curiosity is there some major difference in the way you're calculating your error bars that can't be covered by what's in |
No, I don't think so. I just happened to have a situation where I needed And I already had calculated the descriptive statistics using the Anyway, I think I can make the plot I want, I just have to re-factor the Sam
|
Hi Michael, Related to this question, as I understand it the confidence intervals for factorplot and barplot are calculated using a bootstrapping procedure, and are therefore suitable for use with small or nonparametric datasets. Is this correct? (apologies if this is stated somewhere, but I can't find the method for their generation explicitly written in the docs) Thanks, |
Correct, all the confidence intervals are computed using the bootstrap. |
I see two ways to using precomputed errors on a seaborn.barplot by plotting the errorbars directly onto the existing axis:
or
In the former, the The only aesthetic difference I can see to a pure seaborn solution, is the round barline capstyle. |
It's redundant to use the |
One use case for custom errors is large datasets where bootstrap confidence intervals take a long time to compute, and sensible CIs can be computed by other means. |
This thread was very helpful. Thank you, everyone. Out of curiosity, in my field we frequently have very few replicates (n = 3 - 5) because of difficulty/expense per replicate. How well does bootstrapping work for representing error of very small datasets? I typically use standard deviation rather than standard error to avoid of over-stating the significance of my data. Does anyone have a recommendation on how to best use bootstrapping in this case? Thanks for your time. And Seaborn rocks. |
If you have an N = 3-5, why not just show all the datapoints? |
Hi. Thanks for seaborn. I love it. I have an issue with the custom error bars
And I can plot easily with If I understood correctly, there is not an easy way to plot the error bars. Here I found that a possible workaround could be:
But I am not sure about the order. Is it the Reverse Alphabetical Order for hue? I tried plt.errorbar as explained here, but of course didn't work
Am I missing something? Any suggestion? |
Indeed, I cannot feed in something like yerr=[1,2,1,1] to a barplot displaying 4 bars for instance. Has this issue been addressed? It is very sad to be forced to use matplotlib to plot a barplot with pre-calculated errorbars. |
That doesn’t sound sad at all. That sounds like using the correct tool for its intended purpose. |
Sorry but I do not understand, why wouldn't seaborn (or actually pyplot if I get it right) barplot function argument 'yerr' be the correct tool to plot custom nested error bars? I simply meant that seaborn is much much nicer than matplotlib, hence it is sad to have to use matplotlib to get custom error bars, I was criticizing matplotlib rather than your great module :) |
My opinion is that seaborn is a (general purpose) visualization tool, it is not up to seaborn to calculate the confidence intervals. Yeah, it's practical to be able to do so and it is a plus, but it should above all be able to display the given data. No ? |
If the confidence interval is symmetric, the data can be massaged pretty easily to work around the lack of this feature:
And Bob's your uncle. |
I would really encourage everyone who wants to add errorbars from prespecified error values to use matplotlib, a tool that handles this use case well, rather than trying to hack functionality from seaborn that is intended to do something different. |
Missing from the tutorial/documentation, not sure if this is doable or how to do it:
dataframe -> factor plot #works great
How do I get it to use one of my other columns containing the errors (calculated elsewhere)?
Tried following matplotlib instructions for 'tweaking', doesn't work. Can't find good examples.
The text was updated successfully, but these errors were encountered: