Skip to content
Advertisement

Color the shaded area under the curve distribution plot different colors

I’m using seaborn’s kdeplot to draw the distribution of my data.

JavaScript

I want to divide the shaded area under the line into three parts, showing the “high” percentile and the “low” percentile. It would be ideal if I can color the shaded area with three different colors.

Any idea how I can go about doing that?

I want it to look something like the below where I can decide the cutoff value between the colors.

enter image description here

Advertisement

Answer

So I figured out how to do it. I would retrieve and x and y arrays from the seaborn plot, then use fill_between to color under the curve.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement