Seaborn ValueError: zero-size array to reduction operation minimum which has no identity
- This issue seems to be resolved for
matplotlib==3.3.2
- seaborn: Scatterplot fails with matplotlib==3.3.1 #2194
- With
matplotlib
version3.3.1
- A workaround is to send a
list
tohue
, by using.tolist()
- Use
hue=tips.time.tolist()
.
- Use
- The normal behavior adds a
title
to the legend, but sending alist
tohue
does not add the legend title.- The legend title can be added manually.
import seaborn as sns
# load data
tips = sns.load_dataset("tips")
# But adding 'hue' gives the error below:
ax = sns.scatterplot(x="total_bill", y="tip", hue=tips.time.tolist(), data=tips)
ax.legend(title='time') # add a title to the legend
I ran conda install -c conda-forge matplotlib==3.3.0
given known errors in 3.3.1.
A right answer, but not a great solution.