# Get this figure: fig = py.get_figure("https://chart-studio.plotly.com/~messier51/7/")
# Get this figure's data: data = py.get_figure("https://chart-studio.plotly.com/~messier51/7/").get_data()
# Add data to this figure: py.plot(Data([Scatter(x=[1, 2], y=[2, 3])]), filename ="2014.2015 season", fileopt="extend")
# Get y data of first trace: y1 = py.get_figure("https://chart-studio.plotly.com/~messier51/7/").get_data()[0]["y"]

# Get figure documentation: https://chart-studio.plotly.com/python/get-requests/
# Add data documentation: https://chart-studio.plotly.com/python/file-options/

# If you're using unicode in your file, you may need to specify the encoding.
# You can reproduce this figure in Python with the following code!

# Learn about API authentication here: https://chart-studio.plotly.com/python/getting-started
# Find your api_key here: https://chart-studio.plotly.com/settings/api

import plotly.plotly as py
from plotly.graph_objs import *
py.sign_in('username', 'api_key')
trace1 = {
  "uid": "c0916a", 
  "line": {
    "color": "rgb(0, 67, 88)", 
    "width": 1
  }, 
  "mode": "lines+markers", 
  "name": "arrow", 
  "type": "scatter", 
  "x": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"], 
  "y": ["1.0", "0.8", "0.9", "1.0", "1.1", "0.9", "0.9", "1.4", "1.1", "1.1", "1.1", "1.2", "1.1", "1.2", "1.1", "0.9", "1.0", "0.8", "0.9", "1."], 
  "marker": {
    "color": "rgb(0, 67, 88)", 
    "symbol": "hexagon-open"
  }, 
  "error_x": {"copy_ystyle": True}, 
  "error_y": {
    "color": "rgb(0, 67, 88)", 
    "width": 1, 
    "thickness": 1
  }
}
trace2 = {
  "uid": "716396", 
  "line": {
    "color": "rgb(31, 138, 112)", 
    "width": 1
  }, 
  "mode": "lines+markers", 
  "name": "supernatural", 
  "type": "scatter", 
  "x": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"], 
  "y": ["1.1", "1.0", "0.9", "0.8", "0.9", "1.0", "0.9", "0.9", "1.0", "1.0", "0.7", "0.8", "0.8", "0.8", "0.6", "0.7", "0.6", "0.6", "0.7", "0.7"], 
  "marker": {
    "color": "rgb(31, 138, 112)", 
    "symbol": "hexagon-open"
  }, 
  "error_x": {"copy_ystyle": True}, 
  "error_y": {
    "color": "rgb(31, 138, 112)", 
    "width": 1, 
    "thickness": 1
  }
}
trace3 = {
  "uid": "321b44", 
  "line": {
    "color": "rgb(190, 219, 57)", 
    "width": 1
  }, 
  "mode": "lines+markers", 
  "name": "the flash", 
  "type": "scatter", 
  "x": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"], 
  "y": ["1.9", "1.7", "1.5", "1.4", "1.4", "1.4", "1.4", "1.6", "1.5", "1.4", "1.3", "1.3", "1.5", "1.5", "1.3", "1.2", "1.3", "1.4", "1.3", "1.5"], 
  "marker": {
    "color": "rgb(190, 219, 57)", 
    "symbol": "hexagon-open"
  }, 
  "error_x": {"copy_ystyle": True}, 
  "error_y": {
    "color": "rgb(190, 219, 57)", 
    "width": 1, 
    "thickness": 1
  }
}
data = Data([trace1, trace2, trace3])
layout = {
  "title": "2014/2015 season", 
  "width": 730, 
  "xaxis": {
    "type": "linear", 
    "range": [-0.2308970099667773, 21.230897009966778], 
    "title": "episode number", 
    "autorange": True
  }, 
  "yaxis": {
    "type": "linear", 
    "range": [0.5045103092783505, 1.9954896907216493], 
    "title": "nielsen 18-49 ", 
    "autorange": True
  }, 
  "height": 447, 
  "autosize": True, 
  "showlegend": True
}
fig = Figure(data=data, layout=layout)
plot_url = py.plot(fig)