# Having issues populating my graph after returning data from function

**URL:** <https://community.plotly.com/t/having-issues-populating-my-graph-after-returning-data-from-function/29817>\
**Category:** Dash Python\
**Created:** [October 9, 2019, 9:40pm UTC](https://community.plotly.com/t/having-issues-populating-my-graph-after-returning-data-from-function/29817 "2019-10-09T21:40:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jvtech99](https://avatars.discourse-cdn.com/v4/letter/j/50afbb/32.png) [@jvtech99](https://community.plotly.com/u/jvtech99)\
**Post date:** [October 9, 2019, 9:40pm UTC](https://community.plotly.com/t/having-issues-populating-my-graph-after-returning-data-from-function/29817/1 "2019-10-09T21:40:51Z")

</div>

```auto

@app.callback(
    Output("scat", "figure"),
    [Input("select-xaxis", "value"),
     Input("select-yaxis", "value"),
     Input("select-zaxis", "value"),
     Input("select-species", "value"),
     Input('studies', 'value'),
     Input('foams', 'value'),
     Input('surfactants', 'value'),
     Input('additives', 'value'),
     Input('lp', 'value')],
)
def update_scat(selected_x, selected_y, selected_z, selected_species, st, fo, sur, add, lp):
    c = dv[dv['Study'].isin(st)]
    le = c[c['Foam'].isin(fo)]
    an = le[le['Surfactant'].isin(sur)]
    ed = an[an['Additive'].isin(add)]
    cleaned = ed[ed['LiquidPhase'].isin(lp)]

    fig = [go.Figure(data=go.Scatter(x=cleaned[selected_x].to_numpy(),
                                y=cleaned[selected_y].to_numpy(),
                                mode = 'markers',
                                marker = {
                                    "size":20,
                                    "color":cleaned[selected_species],
                                    },
                                text="Study: " + cleaned.Study + "<br />Foam: " + cleaned.Foam + "<br />Surfactant: " + cleaned.Surfactant + "<br />Additive: " + cleaned.Additive + "<br />Liquid Phase: " + cleaned.LiquidPhase,))]

    return {"data": fig,
            "layout": go.Layout(
                paper_bgcolor="#202020",
                height=938,
                xaxis={"title": f"{selected_x.title()}"}, 
                yaxis={"title": f"{selected_y.title()}"}, )
            }

```

Above is my code. I am creating a 2-d scatter plot from within a tab, when I use fig.show() in my return statement it works (but gives me an error of course). With the above code, I get an empty plot. I have tried changing around my x and y axes, but to no avail. I have a 3d graph in another tab, so I know the data/variables used work. Please let me know if you see the problem.
