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

Learning Dash - How to Add Traces

$
0
0

Hello Everyone and sorry for such a simple question.

My goal is to be more functional in Dash to display results of data science applications that I am trying to build - for this application I would like to view some data from one of my data repositories. The tutorial I am following is here - I am trying to alter the code and understand how to add a trace to the top scatter chart which is in the Singapore.py file. The link to the tutorial is here: https://towardsdatascience.com/beginners-guide-to-building-a-multi-page-dashboard-using-dash-5d06dbfc7599

I have attempted two changes:
1)
data = go.Scatter()
data.add_trace[go.scatter(x=dff[‘Date’], y=dff[‘total’],
mode=‘lines+markers’, name=‘Daily confirmed’)]

and 2)
data = [go.Scatter(x=dff[‘Date’], y=dff[‘total’],
mode=‘lines+markers’,name=‘Daily confirmed’)]
data.add_trace[go.Scatter(x=dff[‘Date’], y=dff[‘Daily Imported’],
mode=‘lines+markers’,name=‘Daily confirmed’)]

The code which does work but only includes 1 trace and not multiple traces is:
data = [go.Scatter(x=dff[‘Date’], y=dff[‘total’],
mode=‘lines+markers’,name=‘Daily confirmed’)]

The error I get is:
AttributeError: ‘Scatter’ object has no attribute ‘add_trace’

I am sure there is more information needed - this is my first app and experience with Python so please, if you could reach out and let me know what more to include - I would love to collaborate and use your help to solve my issue.

Thank you,
Chris

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles