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

Plotly-Create to Python Dash

New to Plotly / Dash so bear with me.
I’ve tried the basic tutorials and things seem to work.
I then created a plot in https://plot.ly/create/#/ and went to viewCode -> Python.
How do I migrate this code to a standalone Python/Dash application?

import plotly.plotly as py
from plotly.graph_objs import *
py.sign_in('username', 'api_key')
trace1 = {
  "x": ["1", "2"], 
  "y": ["1", "2"], 
  "mode": "lines", 
  "type": "scatter", 
  "xsrc": "borisw37:5:50eba8", 
  "ysrc": "borisw37:5:58d256"
}
data = Data([trace1])
layout = {
  "autosize": True, 
  "xaxis": {
    "autorange": True, 
    "range": [1, 2], 
    "type": "linear"
  }, 
  "yaxis": {
    "autorange": True, 
    "range": [0.944444444444, 2.05555555556], 
    "type": "linear"
  }
}
fig = Figure(data=data, layout=layout)
plot_url = py.plot(fig)

Issues:

  1. Python says that “data = Data([trace1])” Data is plotly.graph_objs.Data is deprecated

  2. The format looks different than other Dash examples:

    figureTest1=go.Figure(
    data=[
    go.Scatter(
    x=[1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
    2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012],
    y=[219, 146, 112, 127, 124, 180, 236, 207, 236, 263,
    350, 430, 474, 526, 488, 537, 500, 439],
    name=‘Rest of world’,
    )

I guess overall I’m confused about the data types and structure of gcc.Graph() input parameters.
When is Data a dictionary, when is it a JSON object…?