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: https://plot.ly/python/filled-area-plots/

fill='tozeroy fills the area as you want.

1 Like

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.

1 Like

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.