Skip to content
Advertisement

Change displot bar colors to a specific color

I am struggling to change my displot bar colours.

I want to change the colour of the bars to the light blue colour on at the end of the palette (shown below).

enter image description here

I have tried this, but the colour seems to remain as a dark blue, which is not what I want.

sns.color_palette("light:b", as_cmap=True)
sns.displot(data=df, x="col_1", height=7, aspect=2.8, palette="light:b") 

How do I change the colours to a specific colour in the palette?

Advertisement

Answer

Just define your custom colour palette.

palette = ["#090364", "#091e75", "#093885", "#085396", "#086da6", 
           "#0888b7", "#08a2c7" ]

sns.set_style("whitegrid")
plot = sns.displot(....,palette=sns.color_palette(palette, len(palette)),...)
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement