Issue 1:
Hi,

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:

cols = ["Judgment", "Target", "WTP"]
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 "Target" value does not exist for other "Judgments"
['Uncertain (Separate)', '$100 Gift Card', 61],
['Uncertain (Separate)', '$50 Gift Card', 33]
])

data = pd.DataFrame(vals, columns=cols).astype({'WTP': 'float32'})
sns.pointplot(
x="Judgment",
y="WTP",
hue="Target",
data=data
)

Throws: ValueError: Invalid RGBA argument: 0.6274509803921569

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.

Issue 2:
Hi guys,

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:

Python 3.9.0

matplotlib==3.3.3

seaborn==0.11.0

When plotting a pointplot with sparse data, depending of the shape of the data, the plot is not completely generated, ending with the following ValueError: Invalid RGBA argument: ..., I suppose having to do with some of the graphical elements.

Working Example

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)

This works, and the result if following:

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

Selection of subset that works

Now, if I try to select a subset of the data to display using the parameter order, sometimes it works, sometimes not...

It seems that any combination of 2 or 4 elements works, such as

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']

Selection of subset that does NOT work

But when I try to select 3 elements, trouble arises. Any of those command will give the same error.

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'])

I tried simply removing the unwanted data from df, it still doesn't work:

g = sns.pointplot(x='Period',y='value',hue='Type',
data=df[df['Period'].isin(['2018','2019','2020'])])

The problem also seems to be limited to pointplot, as others plots apparently work well:

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'])

I try to lookup online to find a solution, but couldn't seem to find anything.

Error log

ValueError Traceback (most recent call last)

in

----> 1 g = sns.pointplot(x='Period',y='value',hue='Type',data=df,

2 order=['b','2019','2020']

3 )

/usr/local/lib/python3.9/site-packages/seaborn/_decorators.py in inner_f(*args, **kwargs)

44 )

45 kwargs.update({k: arg for k, arg in zip(sig.parameters, args)})

---> 46 return f(**kwargs)

47 return inner_f

48

/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)

3368 ax = plt.gca()

3369

-> 3370 plotter.plot(ax)

3371 return ax

3372

/usr/local/lib/python3.9/site-packages/seaborn/categorical.py in plot(self, ax)

1786 def plot(self, ax):

1787 """Make the plot."""

-> 1788 self.draw_points(ax)

1789 self.annotate_axes(ax)

1790 if self.orient == "h":

/usr/local/lib/python3.9/site-packages/seaborn/categorical.py in draw_points(self, ax)

1779 x = y = [np.nan] * n_points

1780

-> 1781 ax.scatter(x, y, label=hue_level,

1782 facecolor=color, edgecolor=color,

1783 linewidth=mew, marker=marker, s=markersize,

/usr/local/lib/python3.9/site-packages/matplotlib/init.py in inner(ax, data, *args, **kwargs)

1445 def inner(ax, *args, data=None, **kwargs):

1446 if data is None:

-> 1447 return func(ax, *map(sanitize_sequence, args), **kwargs)

1448

1449 bound = new_sig.bind(ax, *args, **kwargs)

/usr/local/lib/python3.9/site-packages/matplotlib/cbook/deprecation.py in wrapper(*inner_args, **inner_kwargs)

409 else deprecation_addendum,

410 **kwargs)

--> 411 return func(*inner_args, **inner_kwargs)

412

413 return wrapper

/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)

4486 offsets = np.ma.column_stack([x, y])

4487

-> 4488 collection = mcoll.PathCollection(

4489 (path,), scales,

4490 facecolors=colors,

/usr/local/lib/python3.9/site-packages/matplotlib/collections.py in init(self, paths, sizes, **kwargs)

951 """

952

--> 953 super().init(**kwargs)

954 self.set_paths(paths)

955 self.set_sizes(sizes)

/usr/local/lib/python3.9/site-packages/matplotlib/cbook/deprecation.py in wrapper(*inner_args, **inner_kwargs)

409 else deprecation_addendum,

410 **kwargs)

--> 411 return func(*inner_args, **inner_kwargs)

412

413 return wrapper

/usr/local/lib/python3.9/site-packages/matplotlib/collections.py in init(self, edgecolors, facecolors, linewidths, linestyles, capstyle, joinstyle, antialiaseds, offsets, transOffset, norm, cmap, pickradius, hatch, urls, offset_position, zorder, **kwargs)

173 self._hatch_color = mcolors.to_rgba(mpl.rcParams['hatch.color'])

174 self.set_facecolor(facecolors)

--> 175 self.set_edgecolor(edgecolors)

176 self.set_linewidth(linewidths)

177 self.set_linestyle(linestyles)

/usr/local/lib/python3.9/site-packages/matplotlib/collections.py in set_edgecolor(self, c)

828 """

829 self._original_edgecolor = c

--> 830 self._set_edgecolor(c)

831

832 def set_alpha(self, alpha):

/usr/local/lib/python3.9/site-packages/matplotlib/collections.py in _set_edgecolor(self, c)

812 except AttributeError:

813 pass

--> 814 self._edgecolors = mcolors.to_rgba_array(c, self._alpha)

815 if set_hatch_color and len(self._edgecolors):

816 self._hatch_color = tuple(self._edgecolors[0])

/usr/local/lib/python3.9/site-packages/matplotlib/colors.py in to_rgba_array(c, alpha)

339 return np.zeros((0, 4), float)

340 else:

--> 341 return np.array([to_rgba(cc, alpha) for cc in c])

342

343

/usr/local/lib/python3.9/site-packages/matplotlib/colors.py in (.0)

339 return np.zeros((0, 4), float)

340 else:

--> 341 return np.array([to_rgba(cc, alpha) for cc in c])

342

343

/usr/local/lib/python3.9/site-packages/matplotlib/colors.py in to_rgba(c, alpha)

187 rgba = None

188 if rgba is None: # Suppress exception chaining of cache lookup failure.

--> 189 rgba = _to_rgba_no_colorcycle(c, alpha)

190 try:

191 _colors_full_map.cache[c, alpha] = rgba

/usr/local/lib/python3.9/site-packages/matplotlib/colors.py in _to_rgba_no_colorcycle(c, alpha)

261 # tuple color.

262 if not np.iterable(c):

--> 263 raise ValueError(f"Invalid RGBA argument: {orig_c!r}")

264 if len(c) not in [3, 4]:

265 raise ValueError("RGBA sequence should have length 3 or 4")

ValueError: Invalid RGBA argument: 0.054901960784313725