Getting-started examples : interactive - why update_graph or update_figure?


#1

newb here, working through the interactive examples in https://dash.plot.ly/getting-started-part-2

in the first interactive example (with one slider bar as input), @app.callback includes function update_figure.

@app.callback(
dash.dependencies.Output(‘graph-with-slider’, ‘figure’),
[dash.dependencies.Input(‘year-slider’, ‘value’)])
def update_figure(selected_year):

in the second interactive example, multiple inputs are used, @app.callback includes function update_graph.

@app.callback(
dash.dependencies.Output(‘indicator-graphic’, ‘figure’),
[dash.dependencies.Input(‘xaxis-column’, ‘value’),
dash.dependencies.Input(‘yaxis-column’, ‘value’),
dash.dependencies.Input(‘xaxis-type’, ‘value’),
dash.dependencies.Input(‘yaxis-type’, ‘value’),
dash.dependencies.Input(‘year–slider’, ‘value’)])
def update_graph(xaxis_column_name, yaxis_column_name,
xaxis_type, yaxis_type,
year_value):

neither of these code examples show where update_graph or update_figure are called. I thought maybe these methods were called by the package code but can’t find a reference in the documentation.

edit: just checked & discovered these methods defined within the app.callback can be named anything and will still run, so it’s a callback thing (which I should have expected, but eh. newb q’s) Leaving this question and self answer here in case a future newb with same question finds this useful.