# Fill line depending on Y values

Hello,
I am new here. I have stunned during 2 weeks trying a get a continous line, with plotly, filled by interval depending on the y axis.
I am a geologist, and we have drilled a well from the earth surface (depth=0) to underground (depth = 2500 meters). From top to the bottom of the well, we have succession of different nature of rock (FACIES): each facies labelled by a number (LITHO_NUM) and a color (LITHO_COLOR).
What I want to do is to plot this succession filling each depth interval by its corresponding color … y=the depths (from 0 to bottom) and x=LITHO_NUM.
I used 'fill=‘tozerox’ in a ‘for loop’ to set one ‘fillcolor’ per iteration (because fillcolor accept an individual color). The issue is, for each facies, plotly fill all the depth range, from the first time the facies does occurs and the last position depth. I mean, plotly fill the intervals where the facies occurs and also the gaps where it does not occurs (where other facies occur).

import numpy as np
from plotly.subplots import make_subplots
import plotly.graph_objects as go
fig=make_subplots(rows=1, cols=1)

for sf in cm.FACIES.unique():
go.Line(x=cm[cm.FACIES.isin([sf])].LITHO_NUM,
y=cm[cm.FACIES.isin([sf])].DEPTH_MD,
fill=‘tozerox’,
fillcolor=litho_color[sf],
line=dict(color=litho_color[sf], width=1),
name=sf,
)
)

fig.update_layout(width=500, height=1000)
fig.update_yaxes(autorange=“reversed”
)
fig.show()