I am using seaborn and want to generate a box plot where all boxes have the same color. For some reason seaborn uses different colors for each box and doesn't have an option to stop this behavior and set the same color for all boxes.
How can I force seaborn to use the same color for all boxes?
fig, ax = plt.subplots(figsize=(10, 20))
sns.boxplot(y='categorical_var', x='numeric_var', ax=ax)
Use the color
parameter:
import seaborn as sns
tips = sns.load_dataset("tips")
sns.boxplot(x="day", y="tip", data=tips, color="seagreen")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With