Black Lives Matter. Please consider donating to Black Girls Code today.

Plotting large number of graphs

Hi,

I am plotting a large number of graphs, ~100, in dash (inside a callback). The process is rather slow to generate the children div. What takes a lot of time is 1) go.Figure() and 2) fig.update_layout().

If i split my code like this:

inside = go.Scatter(
                x=prices.index,
                y=prices.values,
                mode='lines',
                marker_color='#095251'
            ),
fig = go.Figure(inside)
fig.update_layout(
                showlegend=False,
                template='plotly_dark',
                xaxis=dict(showticklabels=False, showgrid=False),
                yaxis=dict(showticklabels=False),
                #height=60,
                margin=dict(l=0, r=0, t=0, b=0),
                #color_discrete_sequence=px.colors.diverging.Temps,
            )

it takes 0.005 sec to execute “inside”, 0.23 sec to execute go.Figure() and 0.11 sec to execute update_layout.
Is there a way to improve this?

Thank you!