Skip to content

Box plots with log-scaled whiskers #7388

Open
@alexcjohnson

Description

@alexcjohnson
Collaborator

The standard formula we use for the length of box plot whiskers is 1.5 * IQR (interquartile range, ie the third quartile minus the first quartile). This is based on comparing your distribution to a normal distribution, where any data beyond those whiskers is considered an outlier. However, if you're displaying your data on a log scale (and sometimes even if you're not) a log-normal distribution is likely more appropriate, in which case the whisker locations should be calculated based on the IQR in log units. This brings both fences up, in particular preventing the lower fence from ever going negative ie an infinitely long whisker on a log scale.

I'd propose a new attribute for box traces, something like distribution: 'normal' | 'log-normal' | 'auto' where 'auto' uses 'log-normal' when displayed on a log axis, otherwise 'normal'. I'll be happy to submit a PR to add this functionality.

Activity

added a commit that references this issue on Mar 19, 2025
b8b8e24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @alexcjohnson

      Issue actions

        Box plots with log-scaled whiskers · Issue #7388 · plotly/plotly.js