Change displot bar colors to a specific color

Question:

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?

Asked By: user14414885

||

Answers:

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)),...)
Answered By: ashraful16
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.