How to get figure object from dcc.Graph instead of dict

Hi @luggie

One way to do this is to add:

import plotly.graph_objects as go

Then in your callback start with:

fig=go.Figure(fig)

This will convert the dictionary to a figure object and you can update it using things like fig.add_trace()

And this is probably just a typo, but:

Input('button', 'n_click'),

should be:

Input('button', 'n_clicks'),

I hope this helps :slight_smile:

2 Likes