diff --git a/doc/_docstrings/catplot.ipynb b/doc/_docstrings/catplot.ipynb index 6e3ee7d06b..fcfff16beb 100644 --- a/doc/_docstrings/catplot.ipynb +++ b/doc/_docstrings/catplot.ipynb @@ -87,7 +87,7 @@ "source": [ "sns.catplot(\n", " data=df, x=\"age\", y=\"class\", hue=\"sex\",\n", - " kind=\"violin\", bw=.25, cut=0, split=True,\n", + " kind=\"violin\", bw_adjust=.5, cut=0, split=True,\n", ")" ] }, diff --git a/seaborn/_core/groupby.py b/seaborn/_core/groupby.py index cc41566cde..cb63c670d2 100644 --- a/seaborn/_core/groupby.py +++ b/seaborn/_core/groupby.py @@ -93,7 +93,7 @@ def agg(self, data: DataFrame, *args, **kwargs) -> DataFrame: res = ( data - .groupby(grouper, sort=False, observed=True) + .groupby(grouper, sort=False, observed=False) .agg(*args, **kwargs) .reindex(groups) .reset_index() @@ -113,7 +113,7 @@ def apply( return self._reorder_columns(func(data, *args, **kwargs), data) parts = {} - for key, part_df in data.groupby(grouper, sort=False): + for key, part_df in data.groupby(grouper, sort=False, observed=False): parts[key] = func(part_df, *args, **kwargs) stack = [] for key in groups: diff --git a/seaborn/axisgrid.py b/seaborn/axisgrid.py index 2e35304940..17d333bc89 100644 --- a/seaborn/axisgrid.py +++ b/seaborn/axisgrid.py @@ -1522,7 +1522,7 @@ def _map_diag_iter_hue(self, func, **kwargs): fixed_color = kwargs.pop("color", None) for var, ax in zip(self.diag_vars, self.diag_axes): - hue_grouped = self.data[var].groupby(self.hue_vals) + hue_grouped = self.data[var].groupby(self.hue_vals, observed=True) plot_kwargs = kwargs.copy() if str(func.__module__).startswith("seaborn"): @@ -1629,7 +1629,7 @@ def _plot_bivariate_iter_hue(self, x_var, y_var, ax, func, **kwargs): else: axes_vars = [x_var, y_var] - hue_grouped = self.data.groupby(self.hue_vals) + hue_grouped = self.data.groupby(self.hue_vals, observed=True) for k, label_k in enumerate(self._hue_order): kws = kwargs.copy()