箱线图:按x值表示的颜色和按图案区分的色相 [英] Boxplot: colors by x value and hues differentiated by pattern
问题描述
说我有一个类似于以下所示的箱线图:
Say I have a boxplot like the one shown below:
我想获得其他颜色:
-
Fri
,Sat
和Sun
染成蓝色;星期四
将被涂成红色
Fri
,Sat
andSun
would be colored blue;Thur
would be colored red
我想用框中的图案来区分色相(剥离
I would like to differentiate hues with a pattern in the box (stripped or something)
我找不到一种使用海洋调色板进行此操作的方法。
I can't find a way to do this manipulation using seaborn palette.
我知道我可以直接在matplotlib中弄乱一个boxplot的盒子,但是seaborn给了我轴。在这种情况下,如何获取盒子?
I know I can mess with the boxes of a boxplot in matplotlib directly but seaborn gives me the axes back. How can I get the boxes in this case?
推荐答案
盒子最终出现在艺术家
在返回的轴上列出,因此您只需要操纵这些对象上的属性即可:
The boxes end up in the artists
list on the returned axes, so you just need to manipulate the attributes on those objects:
ax = sns.boxplot(data=x)
box = ax.artists[0]
box. set_facecolor("white")
等。
这篇关于箱线图:按x值表示的颜色和按图案区分的色相的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!