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 version 3.3.1
  • A workaround is to send a list to hue, by using .tolist()
    • Use hue=tips.time.tolist().
  • The normal behavior adds a title to the legend, but sending a list to hue does not add the legend title.
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

enter image description here

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.