【发布时间】:2017-05-11 20:12:29
【问题描述】:
我正在尝试为使用seaborn 创建的barplot 设置边缘颜色。问题似乎出在我使用色调参数时。
edgecolor 参数不是为每个单独的条设置一个单独的颜色,而是将颜色应用于整个色调/组。
通过这个简单的例子重现问题。
tips = sns.load_dataset("tips")
t_df = tips.groupby(['day','sex'])['tip'].mean().reset_index()
因此 t_df 将是 ,
clrs = ["#348ABD", "#A60628"]
t_ax = sns.barplot(x='day',y='tip',hue='sex',data=t_df,alpha=0.75,palette= sns.color_palette(clrs),edgecolor=clrs)
plt.setp(t_ax.patches, linewidth=3) # This is just to visualize the issue.
这给出的输出,
我想要的是蓝色条应该有蓝色边缘颜色和红色相同。这需要什么代码更改?
【问题讨论】:
-
你应该提交一份错误报告。
标签: matplotlib seaborn