Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Fill according to y-values

HI all,

I was wondering how to recreate this graph (made it with paint).

I just want to fill one trace according to the tick-level on the y-axis. Any suggestions?

@fseyn Take a look at this tutorial:

fill='tozeroy fills the area as you want.

unfortunately, this only fills in one color.

I am looking for the solution where i can color for specific values…

example values:
x = [1,2,3,4,5,6,7,8]
y = [ 3,3,3,1,1,6,6,6]
color red in [0,2] and green in [2,5]

You should define three filled areas. The lower one is filled tozeroy and the last two
using tonexty. I thought this can be deduced from the examples presented at the link I posted.

I should indeed have been clear by the examples but apparently, it was not for me…

Thanks for the clarification. I was hoping there would be a solution like ‘tovaluey’ but indeed, a workaround fixes it.