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

Plotting dynamic y variables in Plotly figure in Dash Return function

Hi below is some of my code using to plot a simple line graph in DASH. The problem i run into is plot another line but I do not know how many y-variables will be selected from the user. The y-variables come from a list. So the user can select 1 or 5 y variables but i do not know how to graph that.

return html.Div([
figure = {
‘data’: [
{‘x’:dataframe.index, ‘y’:dataframe[column_head], ‘type’:‘line’,‘name’:‘Clean Basis’},
{‘x’:dataframe.index, ‘y’:dataframe[dma1+’ dma’], ‘type’:‘line’,‘name’:‘dma’, ‘color’:‘red’},
{‘x’:dataframe.index, ‘y’:dataframe[dma1+’ Alert’],‘type’:‘scatter’,‘mode’:‘markers’,‘symbol’:‘circles’,‘name’:‘dma Alert’, ‘color’:‘blue’},
{‘x’:merged_R.index, ‘y’:merged_R[‘Predict’], ‘type’:‘line’,‘name’:‘Predict’},

**line in question below:
{‘x’:merged_R.index, ‘y’:merged_R[???], ‘type’:‘line’}, (this will be one or many y-variables graphed against the same x axis (the index)