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

Updated outliers behavior for boxplot #816

Merged
merged 6 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion future_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ See: [example notebook](https://nbviewer.org/github/JetBrains/lets-plot/blob/mas

- Reduce the default `width`/`height` values for `geom_errorbar()`.

- Change the default `position` value from `'identity'` to `'dodge'` for `geom_errorbar()`, `geom_pointrange()` and `geom_linerange()`.
- Change the default `position` value from `'identity'` to `'dodge'` for `geom_errorbar()`, `geom_pointrange()` and `geom_linerange()`.

- `geom_boxplot()`: the `size` and `stroke` parameters started to affect outliers.


### Fixed
Expand Down
21 changes: 10 additions & 11 deletions python-package/lets_plot/plot/geom.py
Original file line number Diff line number Diff line change
Expand Up @@ -3124,12 +3124,11 @@ def geom_boxplot(mapping=None, *, data=None, stat=None, position=None, show_lege
color_by=color_by, fill_by=fill_by,
**other_args)
if stat is None or stat == 'boxplot':
box_alpha = other_args.get('alpha')
box_color = other_args.get('color')
box_fill = other_args.get('fill')
box_size = other_args.get('size')
size = outlier_size or box_size
outlier_param = lambda name, value: value if value is not None else other_args.get(name)
outlier_fatten = 4
size = outlier_param('size', outlier_size)
if size is not None:
size *= outlier_fatten
boxplot_layer += _geom('point',
mapping=mapping,
data=data,
Expand All @@ -3138,12 +3137,12 @@ def geom_boxplot(mapping=None, *, data=None, stat=None, position=None, show_lege
show_legend=False,
sampling=None,
orientation=orientation,
alpha=outlier_alpha or box_alpha,
color=outlier_color or box_color,
fill=outlier_fill or box_fill,
shape=outlier_shape,
size=None if size is None else outlier_fatten * size,
stroke=outlier_stroke,
alpha=outlier_alpha,
color=outlier_param('color', outlier_color),
fill=outlier_param('fill', outlier_fill),
shape=outlier_param('shape', outlier_shape),
size=size,
stroke=outlier_param('stroke', outlier_stroke),
color_by=color_by, fill_by=fill_by)
return boxplot_layer

Expand Down