I am creating a scatter plot with in each axis the daily performance (between 0 and 1) of given portfolios.
I want to create 2 dropdown menus (one for each axis) to select a portfolio and update the scatter plot accordingly.
I have tried using the ‘update’ method but the updated plot is wrong (values over 200, when x=y scatter doesn’t ‘draw’ a line, can’t come back to original even when selection = previous values)
data10 = [go.Scatter(
x = df.portfolio_pnl,
y = df.sp500_pnl,
mode = 'markers')]
layout10= dict(
title = 'Scatter')
updatemenus = list([
dict(active=-1,
buttons=list([
dict(label = 'S&P 500',
method = 'update',
args = [{'x': 'df.sp500_pnl'},
{}]),
dict(label = 'Portfolio',
method = 'update',
args = [{'x': df.portfolio_pnl},
{}]),
]),
),
])
layout10['updatemenus'] = updatemenus
plot({
'data' : data10,
'layout' : layout10,
})
Is there a problem in the method itself ?
Every hint appreciated !
Thanks,