<p dir="auto">Hi,</p>
<p dir="auto">First of all, thank you for a great library that I'm using almost daily. I have recently updated seaborn to the latest version, and I'm now facing a bug that I did not have before. When a dataset is missing x/hue pairs, using pointplot will throw a ValueError. See minimal example below:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="cols = [&quot;Judgment&quot;, &quot;Target&quot;, &quot;WTP&quot;]
vals = np.array([
       ['Certain (Separate)', '$100 Gift Card', 72],
       ['Certain (Separate)', '$50 Gift Card', 39],
       ['Uncertain (In Lottery)', '$100 Gift Card', 42],
       ['Uncertain (In Lottery)', '$50 Gift Card', 21],
       ['Uncertain (In Lottery)', '50/50 Lottery', 28], # This &quot;Target&quot; value does not exist for other &quot;Judgments&quot;
       ['Uncertain (Separate)', '$100 Gift Card', 61],
       ['Uncertain (Separate)', '$50 Gift Card', 33]
])

data = pd.DataFrame(vals, columns=cols).astype({'WTP': 'float32'})
sns.pointplot(
    x=&quot;Judgment&quot;,
    y=&quot;WTP&quot;,
    hue=&quot;Target&quot;,
    data=data
)"><pre class="notranslate"><span class="pl-s1">cols</span> <span class="pl-c1">=</span> [<span class="pl-s">"Judgment"</span>, <span class="pl-s">"Target"</span>, <span class="pl-s">"WTP"</span>]
<span class="pl-s1">vals</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">array</span>([
       [<span class="pl-s">'Certain (Separate)'</span>, <span class="pl-s">'$100 Gift Card'</span>, <span class="pl-c1">72</span>],
       [<span class="pl-s">'Certain (Separate)'</span>, <span class="pl-s">'$50 Gift Card'</span>, <span class="pl-c1">39</span>],
       [<span class="pl-s">'Uncertain (In Lottery)'</span>, <span class="pl-s">'$100 Gift Card'</span>, <span class="pl-c1">42</span>],
       [<span class="pl-s">'Uncertain (In Lottery)'</span>, <span class="pl-s">'$50 Gift Card'</span>, <span class="pl-c1">21</span>],
       [<span class="pl-s">'Uncertain (In Lottery)'</span>, <span class="pl-s">'50/50 Lottery'</span>, <span class="pl-c1">28</span>], <span class="pl-c"># This "Target" value does not exist for other "Judgments"</span>
       [<span class="pl-s">'Uncertain (Separate)'</span>, <span class="pl-s">'$100 Gift Card'</span>, <span class="pl-c1">61</span>],
       [<span class="pl-s">'Uncertain (Separate)'</span>, <span class="pl-s">'$50 Gift Card'</span>, <span class="pl-c1">33</span>]
])

<span class="pl-s1">data</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">vals</span>, <span class="pl-s1">columns</span><span class="pl-c1">=</span><span class="pl-s1">cols</span>).<span class="pl-en">astype</span>({<span class="pl-s">'WTP'</span>: <span class="pl-s">'float32'</span>})
<span class="pl-s1">sns</span>.<span class="pl-en">pointplot</span>(
    <span class="pl-s1">x</span><span class="pl-c1">=</span><span class="pl-s">"Judgment"</span>,
    <span class="pl-s1">y</span><span class="pl-c1">=</span><span class="pl-s">"WTP"</span>,
    <span class="pl-s1">hue</span><span class="pl-c1">=</span><span class="pl-s">"Target"</span>,
    <span class="pl-s1">data</span><span class="pl-c1">=</span><span class="pl-s1">data</span>
)</pre></div>
<p dir="auto">Throws: ValueError: Invalid RGBA argument: 0.6274509803921569</p>
<p dir="auto">My intuition is that Seaborn expects a "balanced" dataset in which all x/hue pairs exists, but I'm not sure how to fix it.</p>
<p dir="auto">Hi guys,</p>
<p dir="auto">I recently updated python packages, and it broke my script running under python 3.8. Sadly, I don't have a list of the previous versions. I try to reinstall fresh on python 3.9, but the problem persists. Both on Mac OS 10.15 and Windows 10. Here are the versions presently used:</p>
<blockquote>
<p dir="auto">Python 3.9.0<br>
matplotlib==3.3.3<br>
seaborn==0.11.0</p>
</blockquote>
<p dir="auto">When plotting a <code class="notranslate">pointplot</code> with sparse data, depending of the shape of the data, the plot is not completely generated, ending with the following <code class="notranslate">ValueError: Invalid RGBA argument: ...</code>, I suppose having to do with some of the graphical elements.</p>
<h3 dir="auto">Working Example</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import pandas as pd
import seaborn as sns

# initialize some sparse data
data = {'Type':['A2', 'A2','A2','A2','A2', 'A3', 'A3','A3','A4','A4','A4','A4'], 
        'Period':['2018', 'a','2019', 'b', '2020', '2018', 'a','2020','2018','a','2019','b'],
        'value':[4, 4.2, 4.1, 4.3,4.1, 3, 3.5,3.2, 2.8,2.5,2.4,2.7]} 
df = pd.DataFrame(data) 
print(df)

# do pointplot
g = sns.pointplot(x='Period',y='value',hue='Type',data=df)"><pre class="notranslate"><code class="notranslate">import pandas as pd
import seaborn as sns

# initialize some sparse data
data = {'Type':['A2', 'A2','A2','A2','A2', 'A3', 'A3','A3','A4','A4','A4','A4'], 
        'Period':['2018', 'a','2019', 'b', '2020', '2018', 'a','2020','2018','a','2019','b'],
        'value':[4, 4.2, 4.1, 4.3,4.1, 3, 3.5,3.2, 2.8,2.5,2.4,2.7]} 
df = pd.DataFrame(data) 
print(df)

# do pointplot
g = sns.pointplot(x='Period',y='value',hue='Type',data=df)
</code></pre></div>
<p dir="auto">This works, and the result if following:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="   Type Period  value
0    A2   2018    4.0
1    A2      a    4.2
2    A2   2019    4.1
3    A2      b    4.3
4    A2   2020    4.1
5    A3   2018    3.0
6    A3      a    3.5
7    A3   2020    3.2
8    A4   2018    2.8
9    A4      a    2.5
10   A4   2019    2.4
11   A4      b    2.7"><pre class="notranslate"><code class="notranslate">   Type Period  value
0    A2   2018    4.0
1    A2      a    4.2
2    A2   2019    4.1
3    A2      b    4.3
4    A2   2020    4.1
5    A3   2018    3.0
6    A3      a    3.5
7    A3   2020    3.2
8    A4   2018    2.8
9    A4      a    2.5
10   A4   2019    2.4
11   A4      b    2.7
</code></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/48928957/101200174-38a78980-3666-11eb-98ec-16535e08b188.png"><img src="https://user-images.githubusercontent.com/48928957/101200174-38a78980-3666-11eb-98ec-16535e08b188.png" alt="Unknown" style="max-width: 100%;"></a></p>
<h3 dir="auto">Selection of subset that works</h3>
<p dir="auto">Now, if I try to select a subset of the data to display using the parameter <code class="notranslate">order</code>, sometimes it works, sometimes not...<br>
It seems that any combination of 2 or 4 elements works, such as</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="g = sns.pointplot(x='Period',y='value',hue='Type',data=df,
                  order=['2018','a','2019','2020'])
g = sns.pointplot(x='Period',y='value',hue='Type',data=df,
                  order=['2018','a','b','2019'])
g = sns.pointplot(x='Period',y='value',hue='Type',data=df,
                  order=['2019','b','a','2020'])
g = sns.pointplot(x='Period',y='value',hue='Type',data=df,
                  order=['2018','2020']"><pre class="notranslate"><code class="notranslate">g = sns.pointplot(x='Period',y='value',hue='Type',data=df,
                  order=['2018','a','2019','2020'])
g = sns.pointplot(x='Period',y='value',hue='Type',data=df,
                  order=['2018','a','b','2019'])
g = sns.pointplot(x='Period',y='value',hue='Type',data=df,
                  order=['2019','b','a','2020'])
g = sns.pointplot(x='Period',y='value',hue='Type',data=df,
                  order=['2018','2020']
</code></pre></div>
<h3 dir="auto">Selection of subset that <em>does NOT</em> work</h3>
<p dir="auto">But when I try to select 3 elements, trouble arises. Any of those command will give the same error.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="g = sns.pointplot(x='Period',y='value',hue='Type',data=df,
                  order=['2018','2019','2020'])
g = sns.pointplot(x='Period',y='value',hue='Type',data=df,
                  order=['a','b','2020'])
g = sns.pointplot(x='Period',y='value',hue='Type',data=df,
                  order=['2018','b','2019'])"><pre class="notranslate"><code class="notranslate">g = sns.pointplot(x='Period',y='value',hue='Type',data=df,
                  order=['2018','2019','2020'])
g = sns.pointplot(x='Period',y='value',hue='Type',data=df,
                  order=['a','b','2020'])
g = sns.pointplot(x='Period',y='value',hue='Type',data=df,
                  order=['2018','b','2019'])
</code></pre></div>
<p dir="auto">I tried simply removing the unwanted data from <code class="notranslate">df</code>, it still doesn't work:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="g = sns.pointplot(x='Period',y='value',hue='Type',
                  data=df[df['Period'].isin(['2018','2019','2020'])])"><pre class="notranslate"><code class="notranslate">g = sns.pointplot(x='Period',y='value',hue='Type',
                  data=df[df['Period'].isin(['2018','2019','2020'])])
</code></pre></div>
<p dir="auto">The problem also seems to be limited to <code class="notranslate">pointplot</code>, as others plots apparently work well:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="g = sns.lineplot(x='Period',y='value',hue='Type',
                  data=df[df['Period'].isin(['2018','2019','2020'])])
g = sns.scatterplot(x='Period',y='value',hue='Type',
                  data=df[df['Period'].isin(['2018','2019','2020'])])
g = sns.barplot(x='Period',y='value',hue='Type',data=df,
                  order=['2018','2019','2020'])"><pre class="notranslate"><code class="notranslate">g = sns.lineplot(x='Period',y='value',hue='Type',
                  data=df[df['Period'].isin(['2018','2019','2020'])])
g = sns.scatterplot(x='Period',y='value',hue='Type',
                  data=df[df['Period'].isin(['2018','2019','2020'])])
g = sns.barplot(x='Period',y='value',hue='Type',data=df,
                  order=['2018','2019','2020'])
</code></pre></div>
<p dir="auto">I try to lookup online to find a solution, but couldn't seem to find anything.</p>
<h3 dir="auto">Error log</h3>
<blockquote>
<hr>
<p dir="auto">ValueError                                Traceback (most recent call last)<br>
 in <br>
----&gt; 1 g = sns.pointplot(x='Period',y='value',hue='Type',data=df,<br>
2                   order=['b','2019','2020']<br>
3                  )</p>
<p dir="auto">/usr/local/lib/python3.9/site-packages/seaborn/_decorators.py in inner_f(*args, **kwargs)<br>
44             )<br>
45         kwargs.update({k: arg for k, arg in zip(sig.parameters, args)})<br>
---&gt; 46         return f(**kwargs)<br>
47     return inner_f<br>
48</p>
<p dir="auto">/usr/local/lib/python3.9/site-packages/seaborn/categorical.py in pointplot(x, y, hue, data, order, hue_order, estimator, ci, n_boot, units, seed, markers, linestyles, dodge, join, scale, orient, color, palette, errwidth, capsize, ax, **kwargs)<br>
3368         ax = plt.gca()<br>
3369<br>
-&gt; 3370     plotter.plot(ax)<br>
3371     return ax<br>
3372</p>
<p dir="auto">/usr/local/lib/python3.9/site-packages/seaborn/categorical.py in plot(self, ax)<br>
1786     def plot(self, ax):<br>
1787         """Make the plot."""<br>
-&gt; 1788         self.draw_points(ax)<br>
1789         self.annotate_axes(ax)<br>
1790         if self.orient == "h":</p>
<p dir="auto">/usr/local/lib/python3.9/site-packages/seaborn/categorical.py in draw_points(self, ax)<br>
1779                     x = y = [np.nan] * n_points<br>
1780<br>
-&gt; 1781                 ax.scatter(x, y, label=hue_level,<br>
1782                            facecolor=color, edgecolor=color,<br>
1783                            linewidth=mew, marker=marker, s=markersize,</p>
<p dir="auto">/usr/local/lib/python3.9/site-packages/matplotlib/<strong>init</strong>.py in inner(ax, data, *args, **kwargs)<br>
1445     def inner(ax, *args, data=None, **kwargs):<br>
1446         if data is None:<br>
-&gt; 1447             return func(ax, *map(sanitize_sequence, args), **kwargs)<br>
1448<br>
1449         bound = new_sig.bind(ax, *args, **kwargs)</p>
<p dir="auto">/usr/local/lib/python3.9/site-packages/matplotlib/cbook/deprecation.py in wrapper(*inner_args, **inner_kwargs)<br>
409                          else deprecation_addendum,<br>
410                 **kwargs)<br>
--&gt; 411         return func(*inner_args, **inner_kwargs)<br>
412<br>
413     return wrapper</p>
<p dir="auto">/usr/local/lib/python3.9/site-packages/matplotlib/axes/_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, plotnonfinite, **kwargs)<br>
4486         offsets = np.ma.column_stack([x, y])<br>
4487<br>
-&gt; 4488         collection = mcoll.PathCollection(<br>
4489                 (path,), scales,<br>
4490                 facecolors=colors,</p>
<p dir="auto">/usr/local/lib/python3.9/site-packages/matplotlib/collections.py in <strong>init</strong>(self, paths, sizes, **kwargs)<br>
951         """<br>
952<br>
--&gt; 953         super().<strong>init</strong>(**kwargs)<br>
954         self.set_paths(paths)<br>
955         self.set_sizes(sizes)</p>
<p dir="auto">/usr/local/lib/python3.9/site-packages/matplotlib/cbook/deprecation.py in wrapper(*inner_args, **inner_kwargs)<br>
409                          else deprecation_addendum,<br>
410                 **kwargs)<br>
--&gt; 411         return func(*inner_args, **inner_kwargs)<br>
412<br>
413     return wrapper</p>
<p dir="auto">/usr/local/lib/python3.9/site-packages/matplotlib/collections.py in <strong>init</strong>(self, edgecolors, facecolors, linewidths, linestyles, capstyle, joinstyle, antialiaseds, offsets, transOffset, norm, cmap, pickradius, hatch, urls, offset_position, zorder, **kwargs)<br>
173         self._hatch_color = mcolors.to_rgba(mpl.rcParams['hatch.color'])<br>
174         self.set_facecolor(facecolors)<br>
--&gt; 175         self.set_edgecolor(edgecolors)<br>
176         self.set_linewidth(linewidths)<br>
177         self.set_linestyle(linestyles)</p>
<p dir="auto">/usr/local/lib/python3.9/site-packages/matplotlib/collections.py in set_edgecolor(self, c)<br>
828         """<br>
829         self._original_edgecolor = c<br>
--&gt; 830         self._set_edgecolor(c)<br>
831<br>
832     def set_alpha(self, alpha):</p>
<p dir="auto">/usr/local/lib/python3.9/site-packages/matplotlib/collections.py in _set_edgecolor(self, c)<br>
812         except AttributeError:<br>
813             pass<br>
--&gt; 814         self._edgecolors = mcolors.to_rgba_array(c, self._alpha)<br>
815         if set_hatch_color and len(self._edgecolors):<br>
816             self._hatch_color = tuple(self._edgecolors[0])</p>
<p dir="auto">/usr/local/lib/python3.9/site-packages/matplotlib/colors.py in to_rgba_array(c, alpha)<br>
339         return np.zeros((0, 4), float)<br>
340     else:<br>
--&gt; 341         return np.array([to_rgba(cc, alpha) for cc in c])<br>
342<br>
343</p>
<p dir="auto">/usr/local/lib/python3.9/site-packages/matplotlib/colors.py in (.0)<br>
339         return np.zeros((0, 4), float)<br>
340     else:<br>
--&gt; 341         return np.array([to_rgba(cc, alpha) for cc in c])<br>
342<br>
343</p>
<p dir="auto">/usr/local/lib/python3.9/site-packages/matplotlib/colors.py in to_rgba(c, alpha)<br>
187         rgba = None<br>
188     if rgba is None:  # Suppress exception chaining of cache lookup failure.<br>
--&gt; 189         rgba = _to_rgba_no_colorcycle(c, alpha)<br>
190         try:<br>
191             _colors_full_map.cache[c, alpha] = rgba</p>
<p dir="auto">/usr/local/lib/python3.9/site-packages/matplotlib/colors.py in _to_rgba_no_colorcycle(c, alpha)<br>
261     # tuple color.<br>
262     if not np.iterable(c):<br>
--&gt; 263         raise ValueError(f"Invalid RGBA argument: {orig_c!r}")<br>
264     if len(c) not in [3, 4]:<br>
265         raise ValueError("RGBA sequence should have length 3 or 4")</p>
<p dir="auto">ValueError: Invalid RGBA argument: 0.054901960784313725</p>
</blockquote>