plotly / plotly/plotly.js

boxplots with q1/median/q3 signature always show fences as min/max on hover

Open
#6,212 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
JavaScript
Stars
18.3k
Forks
2k
Avg merge
2d 12h
Merged PRs (30d)
28

Description

Like many who requested the boxplot with q1/median/q3 signature, I have a situation where I am pre-computing these statistics (along with lower and upper fence) from a very large database and then feeding these values to plotly.

I am also pre-computing outliers and adding those as a separate trace.

When using the boxplot with q1/median/q3 signature, we do not have the flexibility to label the fences correctly in the case of outliers.

See the example below (codepen):

image

Here there are no low outliers, so the lower fence is correctly labeled as "min" in the hover. However, the upper fence is labeled as "max" even though there are outliers.

This is confusing to users who wonder why something is labeled as the max when there are points outside of the fence. If I chose not to add the outliers trace, which is probably what most people do who are using this boxplot signature, it would be even more misleading because there would be no hint about whether the underlying data these fences were computed from really have min and max values at the fences, which could lead to some incorrect and bad conclusions about the data.

Fences are not necessarily the min and max, and when using the q1/median/q3 signature, the boxplot has no way of knowing which is the case.

This could be addressed with any of the following:

  1. Allow the ability to override the hover text for this signature
  2. Add an outliers argument to this signature as some have proposed here
  3. Add min/max to the signature – these wouldn't be plotted, but if min < lowerfence, then the hover text for lowerfence would be "lowerfence" (otherwise "min") and similar logic for upperfence/max
  4. Always make the hover text for the lower and upper fences as "lowerfence" and "upperfence" regardless of whether they represent the min/max
  5. Remove the boxplot with q1/median/q3 signature option because it produces a plot that currently by default has statistically incorrect hover info

Personally I lean toward (3).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the boxplot q1/median/q3 signature and reproduce the hover labels using the linked CodePen example. Review how the signature represents fences and outliers, then determine which proposed API behavior is appropriate; done means fence labels no longer imply min/max when that cannot be known, with the example behavior covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.