对于“matplotlib==3.3.2”,此问题似乎已解决*[seaborn:散点图失败,matplotlib==3.3.1#2194](https://github.com/mwaskom/seaborn/issues/2194)*使用
matplotlib版本
3.3.1*解决方法是使用
.tolist()将“list”发送到“hue”*使用
hue=小费时间收费表()`.
正常行为会向图例添加“title”,但向“hue”发送“list”不会添加图例标题。
*图例标题可以手动添加。
import seaborn as sns# load datatips = 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


