More generally, how to change the color values for a subset of the boxes properties in a seaborn boxplot? Be that the median, the whiskers, or such. I'm particularly interested in how to change the median value, as I have to create plots which have a dark colour and the median line can't be seen against it.
Here's some example code:
import matplotlib.pyplot as plt
import seaborn as sns
fig, ax1 = plt.subplots(figsize=(15,5)
colours = ["#000184", "#834177"]
sns.set_palette(sns.color_palette(colours))
tips = sns.load_dataset("tips")
sns.boxplot(x="day", y="total_bill", hue="smoker", data=tips, ax=ax1)
Which creates:
As can be seen, it's quite hard to see the median line against the blue here.
Note - I don't want to change the entire boxplot colour, just a subsection of the lines (in this case the median). Also - the option of changing it for a particular group (in this case the Yes
smokers) is needed, as the colour might not apply to both groups.