2

Say I have a boxplot like the one shown below:

example

I would like to achieve a different coloring:

  • Fri, Sat and Sun 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.

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?

Hugo
  • 557
  • 4
  • 13

1 Answers1

2

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.

mwaskom
  • 46,693
  • 16
  • 125
  • 127