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

How to plot different lines using formulas on the same graph with Dash

$
0
0

Hi everyone,

Here is the problem I am struggling with, I want to plot different lines on the same graph using Dash, the line chart won’t show when I start the app. I have tried with px.line as well as go.figure.

I am just beginning with coding so it might be easy to fix. Here is the code and what appears on the Dash App.

Thank you very much for your help ! :wink:

@app.callback(
Output(component_id=‘our_graph’, component_property=‘figure’),
[Input(component_id=‘Estimated_Annual_tCO2’, component_property=‘Value’),
Input(component_id=‘Price_tCO2’, component_property=‘value’),
Input(component_id=‘Hectares_of_land’, component_property=‘Value’),
Input(component_id=‘Variables_costs_ha’, component_property=‘Value’),
Input(component_id=‘Gap_analysis_fee’, component_property=‘Value’),
Input(component_id=‘Audit_fee’, component_property=‘Value’)]
)

def update_graph(Est_ann_emissions, Price, Hectares_of_land, Var_costs_ha, Gap_fee, Audit_fee):
x=np.arange(0, 11)
y=xEst_ann_emissionsPrice
b= 8375 + Est_ann_emissions0.1x + 0.05Est_ann_emissionsx + 0.02Est_ann_emissionsx + 2500x + Gap_fee + Audit_fee + Hectares_of_landVar_costs_ha
fig = go.Figure()
fig.add_trace(go.Scatter(x=x, y=y, name=‘Turnover’)),
fig.add_trace(go.Scatter(x=x, y=b, name=‘Costs’))

return fig

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 6271

Latest Images

Trending Articles



Latest Images