Show and hide graph

oh ok. That’s because you have

    dcc.Graph(
        id='example-graph'
    )

inside your app.layout. If you want a graph to appear only once callback is activated, you will have to create an empty html.Div inside the app.layout, and use the callback to Output the dcc.graph as the Children of that Div.
And don’t forget to add this line of code

app.config.suppress_callback_exceptions = True

right after “app = dash.Dash()”.

This post might help you more with this.

3 Likes