<p dir="auto">seaborn 0.9.0, installed via pip.</p>
<p dir="auto">I have 10 rows, trying to create pairplot. The plot works fine until I set the hue to a string (object) column that has 4 categories with the breakdown of (4, 3, 2, 1).<br>
Stack trace below:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ValueError                                Traceback (most recent call last)
&lt;ipython-input-62-cc1e7428015b&gt; in &lt;module&gt;()
      8 # ds.dtypes
      9 # ds
---&gt; 10 sns.pairplot(ds, vars=['mark', 'days', 'hours', 'refs'], hue='topic')
     11 # dataset.iloc[0:10,[8,19]]
     12 

/Users/piglet/Library/Python/2.7/lib/python/site-packages/seaborn/axisgrid.pyc in pairplot(data, hue, hue_order, palette, vars, x_vars, y_vars, kind, diag_kind, markers, height, aspect, dropna, plot_kws, diag_kws, grid_kws, size)
   2109             diag_kws.setdefault(&quot;shade&quot;, True)
   2110             diag_kws[&quot;legend&quot;] = False
-&gt; 2111             grid.map_diag(kdeplot, **diag_kws)
   2112     
   2113     # Maybe plot on the off-diagonals

/Users/piglet/Library/Python/2.7/lib/python/site-packages/seaborn/axisgrid.pyc in map_diag(self, func, **kwargs)
   1397                     color = fixed_color
   1398                 
-&gt; 1399                 func(data_k, label=label_k, color=color, **kwargs)
   1400             
   1401             self._clean_axis(ax)

/Users/piglet/Library/Python/2.7/lib/python/site-packages/seaborn/distributions.pyc in kdeplot(data, data2, shade, vertical, kernel, bw, gridsize, cut, clip, legend, cumulative, shade_lowest, cbar, cbar_ax, cbar_kws, ax, **kwargs)
    689         ax = _univariate_kdeplot(data, shade, vertical, kernel, bw,
    690                                  gridsize, cut, clip, legend, ax,
--&gt; 691                                  cumulative=cumulative, **kwargs)
    692     
    693     return ax

/Users/piglet/Library/Python/2.7/lib/python/site-packages/seaborn/distributions.pyc in _univariate_kdeplot(data, shade, vertical, kernel, bw, gridsize, cut, clip, legend, ax, cumulative, **kwargs)
    292                               &quot;only implemented in statsmodels.&quot;
    293                               &quot;Please install statsmodels.&quot;)
--&gt; 294         x, y = _scipy_univariate_kde(data, bw, gridsize, cut, clip)
    295 
    296     # Make sure the density is nonnegative

/Users/piglet/Library/Python/2.7/lib/python/site-packages/seaborn/distributions.pyc in _scipy_univariate_kde(data, bw, gridsize, cut, clip)
    364     &quot;&quot;&quot;Compute a univariate kernel density estimate using scipy.&quot;&quot;&quot;
    365     try:
--&gt; 366         kde = stats.gaussian_kde(data, bw_method=bw)
    367     except TypeError:
    368         kde = stats.gaussian_kde(data)

/Users/piglet/Library/Python/2.7/lib/python/site-packages/scipy/stats/kde.pyc in __init__(self, dataset, bw_method)
    167         self.dataset = atleast_2d(dataset)
    168         if not self.dataset.size &gt; 1:
--&gt; 169             raise ValueError(&quot;`dataset` input should have multiple elements.&quot;)
    170 
    171         self.d, self.n = self.dataset.shape

ValueError: `dataset` input should have multiple elements."><pre class="notranslate"><code class="notranslate">ValueError                                Traceback (most recent call last)
&lt;ipython-input-62-cc1e7428015b&gt; in &lt;module&gt;()
      8 # ds.dtypes
      9 # ds
---&gt; 10 sns.pairplot(ds, vars=['mark', 'days', 'hours', 'refs'], hue='topic')
     11 # dataset.iloc[0:10,[8,19]]
     12 

/Users/piglet/Library/Python/2.7/lib/python/site-packages/seaborn/axisgrid.pyc in pairplot(data, hue, hue_order, palette, vars, x_vars, y_vars, kind, diag_kind, markers, height, aspect, dropna, plot_kws, diag_kws, grid_kws, size)
   2109             diag_kws.setdefault("shade", True)
   2110             diag_kws["legend"] = False
-&gt; 2111             grid.map_diag(kdeplot, **diag_kws)
   2112     
   2113     # Maybe plot on the off-diagonals

/Users/piglet/Library/Python/2.7/lib/python/site-packages/seaborn/axisgrid.pyc in map_diag(self, func, **kwargs)
   1397                     color = fixed_color
   1398                 
-&gt; 1399                 func(data_k, label=label_k, color=color, **kwargs)
   1400             
   1401             self._clean_axis(ax)

/Users/piglet/Library/Python/2.7/lib/python/site-packages/seaborn/distributions.pyc in kdeplot(data, data2, shade, vertical, kernel, bw, gridsize, cut, clip, legend, cumulative, shade_lowest, cbar, cbar_ax, cbar_kws, ax, **kwargs)
    689         ax = _univariate_kdeplot(data, shade, vertical, kernel, bw,
    690                                  gridsize, cut, clip, legend, ax,
--&gt; 691                                  cumulative=cumulative, **kwargs)
    692     
    693     return ax

/Users/piglet/Library/Python/2.7/lib/python/site-packages/seaborn/distributions.pyc in _univariate_kdeplot(data, shade, vertical, kernel, bw, gridsize, cut, clip, legend, ax, cumulative, **kwargs)
    292                               "only implemented in statsmodels."
    293                               "Please install statsmodels.")
--&gt; 294         x, y = _scipy_univariate_kde(data, bw, gridsize, cut, clip)
    295 
    296     # Make sure the density is nonnegative

/Users/piglet/Library/Python/2.7/lib/python/site-packages/seaborn/distributions.pyc in _scipy_univariate_kde(data, bw, gridsize, cut, clip)
    364     """Compute a univariate kernel density estimate using scipy."""
    365     try:
--&gt; 366         kde = stats.gaussian_kde(data, bw_method=bw)
    367     except TypeError:
    368         kde = stats.gaussian_kde(data)

/Users/piglet/Library/Python/2.7/lib/python/site-packages/scipy/stats/kde.pyc in __init__(self, dataset, bw_method)
    167         self.dataset = atleast_2d(dataset)
    168         if not self.dataset.size &gt; 1:
--&gt; 169             raise ValueError("`dataset` input should have multiple elements.")
    170 
    171         self.d, self.n = self.dataset.shape

ValueError: `dataset` input should have multiple elements.
</code></pre></div>
<p dir="auto">Update of matplotlib from 3.6.0 to 3.6.1 breaks pairplot</p>
<p dir="auto"><strong>Versions</strong><br>
seaborn 0.12.0<br>
matplotlib 3.6.1</p>
<p dir="auto">I tested the code with matplotlib 3.6.0 and it works with this version. I assume that this PR <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1352765736" data-permission-text="Title is private" data-url="https://github.com/matplotlib/matplotlib/issues/23751" data-hovercard-type="pull_request" data-hovercard-url="/matplotlib/matplotlib/pull/23751/hovercard" href="https://github.com/matplotlib/matplotlib/pull/23751">matplotlib/matplotlib#23751</a><br>
breaks this workaround:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    138     # bar() needs masked, not empty data, to generate a patch
--&gt; 139     scout, = method([np.nan], [np.nan], **kws)"><pre class="notranslate"><code class="notranslate">    138     # bar() needs masked, not empty data, to generate a patch
--&gt; 139     scout, = method([np.nan], [np.nan], **kws)
</code></pre></div>
<p dir="auto"><strong>Reproducible code example</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import seaborn as sns

penguins = sns.load_dataset(&quot;penguins&quot;)
sns.pairplot(penguins)"><pre class="notranslate"><code class="notranslate">import seaborn as sns

penguins = sns.load_dataset("penguins")
sns.pairplot(penguins)
</code></pre></div>
<p dir="auto"><strong>Output</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="---------------------------------------------------------------------------
StopIteration                             Traceback (most recent call last)
Cell In [3], line 2
      1 penguins = sns.load_dataset(&quot;penguins&quot;)
----&gt; 2 sns.pairplot(penguins)

File /usr/local/lib/python3.9/site-packages/seaborn/axisgrid.py:2144, in pairplot(data, hue, hue_order, palette, vars, x_vars, y_vars, kind, diag_kind, markers, height, aspect, corner, dropna, plot_kws, diag_kws, grid_kws, size)
   2142 diag_kws.setdefault(&quot;legend&quot;, False)
   2143 if diag_kind == &quot;hist&quot;:
-&gt; 2144     grid.map_diag(histplot, **diag_kws)
   2145 elif diag_kind == &quot;kde&quot;:
   2146     diag_kws.setdefault(&quot;fill&quot;, True)

File /usr/local/lib/python3.9/site-packages/seaborn/axisgrid.py:1507, in PairGrid.map_diag(self, func, **kwargs)
   1505     plot_kwargs.setdefault(&quot;hue_order&quot;, self._hue_order)
   1506     plot_kwargs.setdefault(&quot;palette&quot;, self._orig_palette)
-&gt; 1507     func(x=vector, **plot_kwargs)
   1508     ax.legend_ = None
   1510 self._add_axis_labels()

File /usr/local/lib/python3.9/site-packages/seaborn/distributions.py:1418, in histplot(data, x, y, hue, weights, stat, bins, binwidth, binrange, discrete, cumulative, common_bins, common_norm, multiple, element, fill, shrink, kde, kde_kws, line_kws, thresh, pthresh, pmax, cbar, cbar_ax, cbar_kws, palette, hue_order, hue_norm, color, log_scale, legend, ax, **kwargs)
   1416     else:
   1417         method = ax.plot
-&gt; 1418     color = _default_color(method, hue, color, kwargs)
   1420 if not p.has_xy_data:
   1421     return ax

File /usr/local/lib/python3.9/site-packages/seaborn/utils.py:139, in _default_color(method, hue, color, kws)
    134     scout.remove()
    136 elif method.__name__ == &quot;bar&quot;:
    137 
    138     # bar() needs masked, not empty data, to generate a patch
--&gt; 139     scout, = method([np.nan], [np.nan], **kws)
    140     color = to_rgb(scout.get_facecolor())
    141     scout.remove()

File /usr/local/lib/python3.9/site-packages/matplotlib/__init__.py:1423, in _preprocess_data.&lt;locals&gt;.inner(ax, data, *args, **kwargs)
   1420 @functools.wraps(func)
   1421 def inner(ax, *args, data=None, **kwargs):
   1422     if data is None:
-&gt; 1423         return func(ax, *map(sanitize_sequence, args), **kwargs)
   1425     bound = new_sig.bind(ax, *args, **kwargs)
   1426     auto_label = (bound.arguments.get(label_namer)
   1427                   or bound.kwargs.get(label_namer))

File /usr/local/lib/python3.9/site-packages/matplotlib/axes/_axes.py:2373, in Axes.bar(self, x, height, width, bottom, align, **kwargs)
   2371 x0 = x
   2372 x = np.asarray(self.convert_xunits(x))
-&gt; 2373 width = self._convert_dx(width, x0, x, self.convert_xunits)
   2374 if xerr is not None:
   2375     xerr = self._convert_dx(xerr, x0, x, self.convert_xunits)

File /usr/local/lib/python3.9/site-packages/matplotlib/axes/_axes.py:2182, in Axes._convert_dx(dx, x0, xconv, convert)
   2170 try:
   2171     # attempt to add the width to x0; this works for
   2172     # datetime+timedelta, for instance
   (...)
   2179     # removes the units from unit packages like `pint` that
   2180     # wrap numpy arrays.
   2181     try:
-&gt; 2182         x0 = cbook._safe_first_finite(x0)
   2183     except (TypeError, IndexError, KeyError):
   2184         pass

File /usr/local/lib/python3.9/site-packages/matplotlib/cbook/__init__.py:1749, in _safe_first_finite(obj, skip_nonfinite)
   1746     raise RuntimeError(&quot;matplotlib does not &quot;
   1747                        &quot;support generators as input&quot;)
   1748 else:
-&gt; 1749     return next(val for val in obj if safe_isfinite(val))

StopIteration: "><pre class="notranslate"><code class="notranslate">---------------------------------------------------------------------------
StopIteration                             Traceback (most recent call last)
Cell In [3], line 2
      1 penguins = sns.load_dataset("penguins")
----&gt; 2 sns.pairplot(penguins)

File /usr/local/lib/python3.9/site-packages/seaborn/axisgrid.py:2144, in pairplot(data, hue, hue_order, palette, vars, x_vars, y_vars, kind, diag_kind, markers, height, aspect, corner, dropna, plot_kws, diag_kws, grid_kws, size)
   2142 diag_kws.setdefault("legend", False)
   2143 if diag_kind == "hist":
-&gt; 2144     grid.map_diag(histplot, **diag_kws)
   2145 elif diag_kind == "kde":
   2146     diag_kws.setdefault("fill", True)

File /usr/local/lib/python3.9/site-packages/seaborn/axisgrid.py:1507, in PairGrid.map_diag(self, func, **kwargs)
   1505     plot_kwargs.setdefault("hue_order", self._hue_order)
   1506     plot_kwargs.setdefault("palette", self._orig_palette)
-&gt; 1507     func(x=vector, **plot_kwargs)
   1508     ax.legend_ = None
   1510 self._add_axis_labels()

File /usr/local/lib/python3.9/site-packages/seaborn/distributions.py:1418, in histplot(data, x, y, hue, weights, stat, bins, binwidth, binrange, discrete, cumulative, common_bins, common_norm, multiple, element, fill, shrink, kde, kde_kws, line_kws, thresh, pthresh, pmax, cbar, cbar_ax, cbar_kws, palette, hue_order, hue_norm, color, log_scale, legend, ax, **kwargs)
   1416     else:
   1417         method = ax.plot
-&gt; 1418     color = _default_color(method, hue, color, kwargs)
   1420 if not p.has_xy_data:
   1421     return ax

File /usr/local/lib/python3.9/site-packages/seaborn/utils.py:139, in _default_color(method, hue, color, kws)
    134     scout.remove()
    136 elif method.__name__ == "bar":
    137 
    138     # bar() needs masked, not empty data, to generate a patch
--&gt; 139     scout, = method([np.nan], [np.nan], **kws)
    140     color = to_rgb(scout.get_facecolor())
    141     scout.remove()

File /usr/local/lib/python3.9/site-packages/matplotlib/__init__.py:1423, in _preprocess_data.&lt;locals&gt;.inner(ax, data, *args, **kwargs)
   1420 @functools.wraps(func)
   1421 def inner(ax, *args, data=None, **kwargs):
   1422     if data is None:
-&gt; 1423         return func(ax, *map(sanitize_sequence, args), **kwargs)
   1425     bound = new_sig.bind(ax, *args, **kwargs)
   1426     auto_label = (bound.arguments.get(label_namer)
   1427                   or bound.kwargs.get(label_namer))

File /usr/local/lib/python3.9/site-packages/matplotlib/axes/_axes.py:2373, in Axes.bar(self, x, height, width, bottom, align, **kwargs)
   2371 x0 = x
   2372 x = np.asarray(self.convert_xunits(x))
-&gt; 2373 width = self._convert_dx(width, x0, x, self.convert_xunits)
   2374 if xerr is not None:
   2375     xerr = self._convert_dx(xerr, x0, x, self.convert_xunits)

File /usr/local/lib/python3.9/site-packages/matplotlib/axes/_axes.py:2182, in Axes._convert_dx(dx, x0, xconv, convert)
   2170 try:
   2171     # attempt to add the width to x0; this works for
   2172     # datetime+timedelta, for instance
   (...)
   2179     # removes the units from unit packages like `pint` that
   2180     # wrap numpy arrays.
   2181     try:
-&gt; 2182         x0 = cbook._safe_first_finite(x0)
   2183     except (TypeError, IndexError, KeyError):
   2184         pass

File /usr/local/lib/python3.9/site-packages/matplotlib/cbook/__init__.py:1749, in _safe_first_finite(obj, skip_nonfinite)
   1746     raise RuntimeError("matplotlib does not "
   1747                        "support generators as input")
   1748 else:
-&gt; 1749     return next(val for val in obj if safe_isfinite(val))

StopIteration: 
</code></pre></div>
<p dir="auto">Visualization:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/8720575/194966339-c4fae135-1074-45c4-bebe-7a8f6bffd653.png"><img width="836" alt="image" src="https://user-images.githubusercontent.com/8720575/194966339-c4fae135-1074-45c4-bebe-7a8f6bffd653.png" style="max-width: 100%;"></a></p>