Skip to content

[BUG] Boxplot draws whiskers above/below max/min values. #720

@your-diary

Description

@your-diary

Describe the bug

According to Box plot - Wikipedia (emphasis mine):

The whiskers must end at an observed data point, but can be defined in various ways.

In the most straightforward method, the boundary of the lower whisker is the minimum value of the data set, and the boundary of the upper whisker is the maximum value of the data set.

(snip)

Another popular choice for the boundaries of the whiskers is based on the 1.5 IQR value. From above the upper quartile (Q3), a distance of 1.5 times the IQR is measured out and a whisker is drawn up to the largest observed data point from the dataset that falls within this distance. Similarly, a distance of 1.5 times the IQR is measured out below the lower quartile (Q1) and a whisker is drawn down to the lowest observed data point from the dataset that falls within this distance. Because the whiskers must end at an observed data point, the whisker lengths can look unequal, even though 1.5 IQR is the same for both sides.

Boxplot seems not to follow this rule:

  • Actual: Boxplot just plots lower/upper fences.

  • Expected: it should instead plot max(min_value, lower_fence) and min(max_value, upper_fence).

To Reproduce

The problem is reproduced by (but not limited to) the official example for boxplot.

Image

Version Information

0.3.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions