Skip to content

Commit

Permalink
Remove invisible boxplot outliers from the limit calculations
Browse files Browse the repository at this point in the history
closes #814
  • Loading branch information
has2k1 committed Aug 1, 2024
1 parent f96f25f commit 29c77f3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions doc/changelog.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ title: Changelog
set_option("figure_format", False)
```

- For [](:class:`~plotnine.geom_boxplot`) when the outliers are made invisible
by giving them no shape, now they do not affect the limits of the plot.
({{< issue 814 >}})

### New Features

- [](:class:`~plotnine.geom_text`) has gained new aesthetics
Expand Down
7 changes: 6 additions & 1 deletion plotnine/geoms/geom_boxplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,12 @@ def setup_data(self, data: pd.DataFrame) -> pd.DataFrame:
else:
data["width"] = resolution(data["x"], False) * 0.9

if "outliers" not in data:
if (
"outliers" not in data
# Remove outliers if they will not show so that the scale
# limits do not recognise them.
or self.params["outlier_shape"] in (None, "")
):
data["outliers"] = [[] for i in range(len(data))]

# min and max outlier values
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 29c77f3

Please sign in to comment.