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

How do you return no graph?

I want my callback to return nothing before the options are selected. If I return it creates an empty graph. If I return ‘layout’: {“xaxis”: {“visible”: False}, “yaxis”: {“visible”: False}} it returns a big white rectangle and my background-color isn’t white. If I set ‘paper_bgcolor’: mybgcolor, the outside color is correct and I have a smaller white rectangle, but defining ‘plot_bgcolor’: mybgcolor, doesn’t do anything to color the inside. Setting ‘margin’: {‘l’: 20, ‘r’: 30, ‘b’: 20, ‘t’: 30, ‘pad’: 10} reduces it to a white dot, bit still not completely.

There has to be an easier way to return nothing or a correctly colored flat pane?

Can you just adjust the ‘children’ property of the div? In other words, I wouldn’t create the empty graph first, I would create the graph once their options have been selected.

So I create the layout with the graph conditionally unset (no children) when the layout is initialized and the options are undefined. When I later set the options, the callback doesn’t register because the Graph/id is undefined in the layout.

thanks, figured it out using the technique from https://github.com/plotly/dash-recipes/blob/master/dash-add-graphs-dynamically.py updating ‘children’ within a defined Div instead of ‘figure’ within a defined Graph.