按照 Seaborn API 站点上的示例,我似乎无法显示边缘颜色
这是我正在使用的
import seaborn as sns
sns.set_style("whitegrid")
tips = sns.load_dataset("tips")
ax = sns.boxplot(x="day", y="total_bill", data=tips)
ax = sns.stripplot(x="day", y="total_bill", data=tips, size=4, jitter=True, edgecolor="gray")
但这是正在策划的。我错过了什么吗?我在 Python 3 中使用 Seaborn .6 和 Matplotlib 1.4.3
Seaborn Boxplot API
最佳答案
linewidth
大于 0 必须添加到 seaborn.stripplot
, 用于显示边缘颜色 ( ec
)。lw
不会导致错误,但如果lw
,则边缘颜色不会显示用于 linewidth
. python 3.8.11
中测试, pandas 1.3.3
, matplotlib 3.4.3
, seaborn 0.11.2
import seaborn as sns
# load dataframe
tips = sns.load_dataset("tips")
ax = sns.boxplot(x="day", y="total_bill", data=tips)
# add stripplot with linewidth=1
sns.stripplot(x="day", y="total_bill", data=tips, size=4, jitter=True,
edgecolor="gray", ax=ax, linewidth=1)
关于python - Edgecolor 未出现在 Seaborn 条形图中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31152125/