Multiple fill colors

Looking at the graph below, is there any way to set the fill color for the above zero elements (left and right) to green and below zero element (middle) to red?

the only idea I thought of was to compute the y intersection points and make this three lines but that would be challenging.

Hi @marketemp,

There is no easy way to do this, a workaround would be to add separate traces of positive and negative values to your figure as shown in this post - Python Plotly Express: How to conditionally fill an area plot? - Stack Overflow

1 Like

thanks @atharvakatre the df implementation seems like a great way to go with a line like a stock line that breaks the plane multiple times.

I tried drawing one straight line between the middle two points and then just solved it with my original plan of three lines, left, center, and right.

1 Like