AttributeError:seaborn中的未知属性图例

Sha*_*ang 18 python matplotlib legend pandas seaborn

seaborn stripplot具有允许的功能hue.

使用https://stanford.edu/~mwaskom/software/seaborn/generated/seaborn.stripplot.html中的示例

import seaborn as sns
sns.set_style("whitegrid")
tips = sns.load_dataset("tips")
ax = sns.stripplot(x=tips["total_bill"])
ax = sns.stripplot(x="sex", y="total_bill", hue="day", data=tips, jitter=True)
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

在这种情况下,图例非常小,每天显示不同的色调.但是,我想删除传说.

通常,一个包括参数legend=False.但是,对于stripplot,这似乎输出属性错误:

AttributeError: Unknown property legend
Run Code Online (Sandbox Code Playgroud)

可以删除传说stripplots吗?如果是这样,那怎么做呢?

Ser*_*ity 35

ax.legend_.remove()像这里使用:

import seaborn as sns
import matplotlib.pylab as plt
sns.set_style("whitegrid")
tips = sns.load_dataset("tips")
ax = sns.stripplot(x="sex", y="total_bill", hue="day", data=tips, jitter=True)

# remove legend from axis 'ax'
ax.legend_.remove()

plt.show()
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述