|
28 | 28 | _scatter_legend_artist, |
29 | 29 | _version_predates, |
30 | 30 | ) |
| 31 | +from seaborn._compat import groupby_apply_include_groups |
31 | 32 | from seaborn._statistics import ( |
32 | 33 | EstimateAggregator, |
33 | 34 | LetterValues, |
@@ -634,10 +635,10 @@ def get_props(element, artist=mpl.lines.Line2D): |
634 | 635 | ax = self._get_axes(sub_vars) |
635 | 636 |
|
636 | 637 | grouped = sub_data.groupby(self.orient)[value_var] |
| 638 | + positions = sorted(sub_data[self.orient].unique().astype(float)) |
637 | 639 | value_data = [x.to_numpy() for _, x in grouped] |
638 | 640 | stats = pd.DataFrame(mpl.cbook.boxplot_stats(value_data, whis=whis, |
639 | 641 | bootstrap=bootstrap)) |
640 | | - positions = grouped.grouper.result_index.to_numpy(dtype=float) |
641 | 642 |
|
642 | 643 | orig_width = width * self._native_width |
643 | 644 | data = pd.DataFrame({self.orient: positions, "width": orig_width}) |
@@ -1207,7 +1208,7 @@ def plot_points( |
1207 | 1208 | agg_data = sub_data if sub_data.empty else ( |
1208 | 1209 | sub_data |
1209 | 1210 | .groupby(self.orient) |
1210 | | - .apply(aggregator, agg_var) |
| 1211 | + .apply(aggregator, agg_var, **groupby_apply_include_groups(False)) |
1211 | 1212 | .reindex(pd.Index(positions, name=self.orient)) |
1212 | 1213 | .reset_index() |
1213 | 1214 | ) |
@@ -1278,7 +1279,7 @@ def plot_bars( |
1278 | 1279 | agg_data = sub_data if sub_data.empty else ( |
1279 | 1280 | sub_data |
1280 | 1281 | .groupby(self.orient) |
1281 | | - .apply(aggregator, agg_var) |
| 1282 | + .apply(aggregator, agg_var, **groupby_apply_include_groups(False)) |
1282 | 1283 | .reset_index() |
1283 | 1284 | ) |
1284 | 1285 |
|
|
0 commit comments