Both first_selector and second_selector are the ids of Dropdowns which are assigned starter values. I would expect the plot to be populated upon running the app, but nothing I do can seem to get data into the graph.
I’ve checked my filter_dataframe function is working properly as well.
Even inserting simple lists for x and y do not work within make_main_figure() - I tried putting in x = [1,2,3], y = [4,5,6] and the plot is still blank as in my attached image.
@app.callback(Output('main_scatter_plot', 'figure'),
[Input('first_selector', 'value'),
Input('second_selector', 'value')])
def make_main_figure(first_selector, second_selector):
dff = filter_dataframe(DF, first_selector, second_selector)
traces = []
for value in dff['Number'].unique():
df_by_result = dff[dff['Number'] == value]
traces.append(go.Scatter(
x = df_by_result['Metric_1'],
y = df_by_result['Metric_2'],
more = 'markers',
opacity = 0.7,
marker = {'size': 15},
name = result
))
return {'data': [traces], 'layout': go.Layout(title='My Plot',
xaxis = {'title': 'Metric_1', 'type': 'linear'},
yaxis = {'title': 'Metric_2', 'type': 'linear'}
)}