Skip to content

Commit

Permalink
Pass bootstrap option to boxplot stat computation (#3562)
Browse files Browse the repository at this point in the history
* Update categorical.py

Fixing bootstrap issue in boxplot

* Update categorical.py

line too long fixed

* Passing bootstrap to matplotlib's stats computation.

Fixed trailing whitespace issue.
  • Loading branch information
utkarshp authored Nov 18, 2023
1 parent 01fb7bb commit aa3da42
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions seaborn/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ def get_props(element, artist=mpl.lines.Line2D):

if not fill and linewidth is None:
linewidth = mpl.rcParams["lines.linewidth"]

bootstrap = plot_kws.pop("bootstrap", mpl.rcParams["boxplot.bootstrap"])
plot_kws.setdefault("shownotches", plot_kws.pop("notch", False))

box_artist = mpl.patches.Rectangle if fill else mpl.lines.Line2D
Expand All @@ -626,7 +626,8 @@ def get_props(element, artist=mpl.lines.Line2D):

grouped = sub_data.groupby(self.orient)[value_var]
value_data = [x.to_numpy() for _, x in grouped]
stats = pd.DataFrame(mpl.cbook.boxplot_stats(value_data, whis=whis))
stats = pd.DataFrame(mpl.cbook.boxplot_stats(value_data, whis=whis,
bootstrap=bootstrap))
positions = grouped.grouper.result_index.to_numpy(dtype=float)

orig_width = width * self._native_width
Expand Down

0 comments on commit aa3da42

Please sign in to comment.