I try to solve a problem. How to filling in the graph only where the previous curve had no data? I would like to fill only the area marker with a red border. Here is my python code:
fig = go.Figure()
fig.add_trace(go.Scatter(x=df1[‘x’], y=df1[‘y’], fill = ‘tozeroy’, mode=‘lines’, line_color=‘brown’))
fig.add_trace(go.Scatter(x = [df1[‘x’].min(), df1[‘x’].max()], y = [data, data] , fill = ‘tonexty’, mode=‘lines’, line_color=‘blue’))
currently the two charts are overlapping. Thanks for help!
A quick hack would be to just swap your graphs around like this:
fig = go.Figure(data=[
# blue data
go.Scattergl(x = [df1[‘x’].min(), df1[‘x’].max()], y = [data, data] , fill = ‘tonexty’, mode=‘lines’, line_color=‘blue’),
# brown data
go.Scattergl(x=df1[‘x’], y=df1[‘y’], fill = ‘tozeroy’, mode=‘lines’, line_color=‘brown’)]
)
This would place the brown graph over the blue one and so only show when its not covering.
To ensure that this approach works all the time you could make a new dataset for the blue data that is a set of the (x, y=407.8) where the x’s are only those when red data is < y=407.8.