2 years ago

#51605

test-img

plonfat

Python Plotly: avoid fill for NaN values

Any idea on how to achieve that ?

Current issue on chart: enter image description here

Where I would like to avoid extra fillings...

Code used:

    i = 'col'
    pos = df[i] >= 0
    above = np.where(pos, df[i], np.nan)
    below = np.where(pos, np.nan, df[i])
    scatter1 = go.Scatter(x=df.index, y=below, fill='tozeroy')
    scatter2 = go.Scatter(x=df.index, y=above, fill='tozeroy')

    fig.add_trace(scatter1, row=4+j, col=1)
    fig.add_trace(scatter2, row=4+j, col=1)
    fig.add_hline(y=0, row=4+j, col=1)

python

charts

plotly

fill

0 Answers

Your Answer

Accepted video resources