问题
Say I have a boxplot like the one shown below:
I would like to achieve a different coloring:
Fri,SatandSunwould be colored blue;Thurwould be colored redI 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.
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?
回答1:
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")
etc.
来源:https://stackoverflow.com/questions/31206474/boxplot-colors-by-x-value-and-hues-differentiated-by-pattern