From 0ac69be414b89a4ee85315f8427e7eac4b4511d4 Mon Sep 17 00:00:00 2001 From: Utkarsh Patange Date: Thu, 16 Nov 2023 10:34:58 -0500 Subject: [PATCH 1/3] Update categorical.py Fixing bootstrap issue in boxplot --- seaborn/categorical.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seaborn/categorical.py b/seaborn/categorical.py index 6b4d85dae6..a0b127efde 100644 --- a/seaborn/categorical.py +++ b/seaborn/categorical.py @@ -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 @@ -626,7 +626,7 @@ 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 From 64e5afcdf3cd97dd4e293e0316334b10ad386142 Mon Sep 17 00:00:00 2001 From: Utkarsh Patange Date: Thu, 16 Nov 2023 11:03:54 -0500 Subject: [PATCH 2/3] Update categorical.py line too long fixed --- seaborn/categorical.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/seaborn/categorical.py b/seaborn/categorical.py index a0b127efde..f86b51ebc5 100644 --- a/seaborn/categorical.py +++ b/seaborn/categorical.py @@ -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, bootstrap=bootstrap)) + 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 From 22aad7ada5317456ffb0169bdc90c19bc8f715c9 Mon Sep 17 00:00:00 2001 From: Utkarsh Patange Date: Fri, 17 Nov 2023 09:26:57 -0500 Subject: [PATCH 3/3] Passing bootstrap to matplotlib's stats computation. Fixed trailing whitespace issue. --- seaborn/categorical.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seaborn/categorical.py b/seaborn/categorical.py index f86b51ebc5..a469ce8eed 100644 --- a/seaborn/categorical.py +++ b/seaborn/categorical.py @@ -626,7 +626,7 @@ 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)