Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Plotting dynamic y variables in Plotly figure in Dash Return function

$
0
0

@np162629 wrote:

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([
dcc.Graph(id=‘example’,
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)
],

             }

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles