Skip to content
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

Boxplot whisker changes when set "boxpoints" to false #1953

Closed
PPPW opened this issue Aug 15, 2017 · 3 comments
Closed

Boxplot whisker changes when set "boxpoints" to false #1953

PPPW opened this issue Aug 15, 2017 · 3 comments

Comments

@PPPW
Copy link

PPPW commented Aug 15, 2017

Dear plotly.js,
For boxplot, I saw a difference when "boxpoints" is set to "true" and "false", you can use the following example, comment out the "boxpoints" line to see the change:

https://codepen.io/anon/pen/XazgKw?editors=0010

The whisker position for "boxpoints = true" is correct and is what I want, it seems when "boxpoints = false", a different metric is used? Is it possible to fix the behavior? Thanks!

Best,

@alexcjohnson
Copy link
Collaborator

Two things:

  • boxpoints has options 'all', 'outliers', 'suspectedoutliers', false - so true actually reverts to the default 'outliers'
  • The algorithms we used to calculate the whiskers are consistent with, for example http://www.physics.csbsju.edu/stats/box2.html:

If either type of outlier is present the whisker on the appropriate side is taken to 1.5×IQR from the quartile (the "inner fence") rather than the max or min

ie if we're displaying outliers, the outliers show the min/max so the whiskers show what might be expected for a typical spread within the main distribution. But if we're NOT displaying outliers, it's useful to know what the full min/max of the distribution are - especially since the fence values are simply calculated from other metrics of the distribution that are already displayed.

I suppose we could add a mode like boxpoints: 'hidden' to omit outliers but not include them in the whiskers. A workaround is to include marker: {opacity: 0} in your trace, though if you do this the full max/min will still be included in the autorange (and hover, though I notice we have a problem with hover for horizontal boxes, we don't show all the information as we do for vertical boxes)

@PPPW
Copy link
Author

PPPW commented Aug 15, 2017

@alexcjohnson

A workaround is to include marker: {opacity: 0} in your trace

Good idea, I can remove "boxpoints: false" and set the opacity to zero, it worked well for me. In my case, I'd like to hide points for boxplot, and add a scatter series to show the points, because I want the points to be selectable. Thank you!

@alexcjohnson
Copy link
Collaborator

I'm going to close this issue - I copied the interests expressed here in #277 which has even more generality - @PPPW feel free to chime in there if I missed anything - and the hover issue I noticed turns out to have been reported in #778

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants