简体   繁体   中英

Make Seaborn Distplot and Barplot the same color

I have been unable to figure out how to set the colors between distplot and barplot to be the same. Despite setting the color argument in both functions to "blue", they are clearly different shades and I would like them to be the same. Any help would be great as I would like consistency in the project I am working on.

seaborn 分布图

seaborn 条形图

The default "blue" for the tow plotting function is different. For seaborn, you can extract the color in this way:

pal = sns.color_palette("Blues")
print(pal.as_hex())
['#dbe9f6', '#bad6eb', '#89bedc', '#539ecd', '#2b7bba', '#0b559f']

Not sure which blue you might be referring to, but by passing the hex value to matplotlib, you can ensure that they have the same color.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM