Repository navigation
What to do with notched box traces with "inverted ends" ? #4088
Description
Activity
- changed the title
[-]request - better documentation for boxplot notched[/-][+]possible bug - boxplot notched and request for better documentation[/+]on Jul 29, 2019 Also, there are inverted ends when I add notches.
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:
https://codepen.io/destrada/pen/WVONOKhi @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:
- https://rreusser.github.io/plotly-mock-viewer/#box_notched
- https://rreusser.github.io/plotly-mock-viewer/#box_horz_notched
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.
- changed the title
[-]possible bug - boxplot notched and request for better documentation[/-][+]What to do with notched box traces with "inverted ends" ?[/+]on Nov 25, 2019 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 thanks @alexcjohnson @krassowski for clarifying that inverted notches aren't considered a bug :)... 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
