Say I have an app where based on what company a user selects in a dropdown, the office locations of that company are plotted in a map in a dcc.Graph div. Before the user selects anything, I get the blank gridlines:
Is there any way to hide these gridlines and show nothing when nothing is selected in the dropdown? I tried to find if there’s any parameter in dcc.Graph to hide gridlines, but couldn’t find anything.
Hello,
I also had this same question and the code is not working for me for some reason. I am referencing an output in a callback via an id. This is what I used:
Had a similar issue, your callback might get called with an empty/None input when the page is first loaded. Simple way around that is to put the “default figure” in the callback like this:
@app.callback(Output("bar_plot","figure"),[Input("select","value")])
def udpate_plot(selection):
if not selection:
return {
'layout': go.Layout(
xaxis = {
'showgrid': False
},
yaxis = {
'showgrid': True
})
}
#else return actual figure