-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
What to do with notched box traces with "inverted ends" ? #4088
Comments
Thanks for reporting. Could you share the data/layout you used to help us debug? |
Here is a codepen with an example of the bug: |
hi @etpinard . I'm wondering if this has been labeled as a bug and if the codepen I provided helps show what the bug is? Thanks! |
The problem here has to do with samples that have median confidence intervals that go beyond Q1 (and/or Q3) and beyond the lower (and/or upper) fence value. After a quick search, I couldn't find any notched boxplot examples that show "inverted ends". I suspect that some libraries bound the confidence interval to the IQR. But from #2305 (the PR that added notched boxes), looks like the author (@krassowski ) was ok with those "inverted ends" as that PR added two mocks showing inverted ends:
If "inverted ends" are a thing, then the problem is in our autorange-finding routine which should consider the median confidence interval in its computations. If "inverted ends" were added in by mistake, then we should simply bound the median confidence interval accordingly in the calc step. |
FWIW At least matplotlib allows inverted notches too https://stackoverflow.com/questions/38794406/why-is-matplotlibs-notched-boxplot-folding-back-on-itself I feel like I’ve seen this elsewhere as well - And to me it seems like the most honest way to display the notches. But I suppose an option to bound them to the IQR would be a reasonable feature to add. |
On my part, the inverted notches were intended - they highlight an important property of the distribution and are generated by all major packages including matplotlib (above), ggplot etc. Another link to an explanation: https://stats.stackexchange.com/questions/151580/how-to-interpret-notched-box-plots/151584 |
Also, see matplotlib/matplotlib#3631 (comment). |
Thanks @krassowski @alexcjohnson !! I'll adjust the autorange computations accordingly. |
sorry I'm late to the conversation. @etpinard thanks for fixing the autorange. |
... and thank you @destradafilm for reporting this bug !! |
I'm implementing the boxplot notched option, but don't really know what it is exactly and how to explain it to users that choose that option. The plotly documentation doesn't explain how it's calculated
the only thing I found useful online when researching was this:
https://sites.google.com/site/davidsstatistics/home/notched-box-plots
Also, there are inverted ends when I add notches. I'm not sure if this is a bug or expected behavior
The text was updated successfully, but these errors were encountered: