# Get this figure: fig = py.get_figure("https://plotly.com/~tcmoran/47/") # Get this figure's data: data = py.get_figure("https://plotly.com/~tcmoran/47/").get_data() # Add data to this figure: py.plot(Data([Scatter(x=[1, 2], y=[2, 3])]), filename ="SWAPI-Spaceships", fileopt="extend") # Get y data of first trace: y1 = py.get_figure("https://plotly.com/~tcmoran/47/").get_data()[0]["y"] # Get figure documentation: https://plotly.com/python/get-requests/ # Add data documentation: https://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://plotly.com/python/getting-started # Find your api_key here: https://plotly.com/settings/api import plotly.plotly as py from plotly.graph_objs import * py.sign_in('username', 'api_key') trace1 = { "name": "Sentinel-class landing craft", "type": "scatter", "x": [1000.0], "y": [1.0], "marker": { "size": 20.0, "color": "rgb(13, 22, 104)" } } trace2 = { "name": "Millennium Falcon", "type": "scatter", "x": [1050.0], "y": [0.5], "marker": { "size": 42.0, "color": "rgb(27, 230, 9)" } } trace3 = { "name": "Y-wing", "type": "scatter", "x": [1000.0], "y": [1.0], "marker": { "size": 20.0, "color": "rgb(137, 85, 218)" } } trace4 = { "name": "X-wing", "type": "scatter", "x": [1050.0], "y": [1.0], "marker": { "size": 21.0, "color": "rgb(40, 86, 85)" } } trace5 = { "name": "TIE Advanced x1", "type": "scatter", "x": [1200.0], "y": [1.0], "marker": { "size": 24.0, "color": "rgb(62, 0, 111)" } } trace6 = { "name": "Slave 1", "type": "scatter", "x": [1000.0], "y": [3.0], "marker": { "size": 6.666666666666666, "color": "rgb(22, 152, 17)" } } trace7 = { "name": "Imperial shuttle", "type": "scatter", "x": [850.0], "y": [1.0], "marker": { "size": 17.0, "color": "rgb(80, 114, 231)" } } trace8 = { "name": "EF76 Nebulon-B escort frigate", "type": "scatter", "x": [800.0], "y": [2.0], "marker": { "size": 8.0, "color": "rgb(23, 36, 202)" } } trace9 = { "name": "A-wing", "type": "scatter", "x": [1300.0], "y": [1.0], "marker": { "size": 26.0, "color": "rgb(5, 233, 146)" } } trace10 = { "name": "B-wing", "type": "scatter", "x": [950.0], "y": [2.0], "marker": { "size": 9.5, "color": "rgb(67, 214, 196)" } } trace11 = { "name": "Republic Cruiser", "type": "scatter", "x": [900.0], "y": [2.0], "marker": { "size": 9.0, "color": "rgb(87, 205, 52)" } } trace12 = { "name": "Naboo fighter", "type": "scatter", "x": [1100.0], "y": [1.0], "marker": { "size": 22.0, "color": "rgb(155, 134, 207)" } } trace13 = { "name": "Naboo Royal Starship", "type": "scatter", "x": [920.0], "y": [1.8], "marker": { "size": 10.222222222222221, "color": "rgb(80, 101, 196)" } } trace14 = { "name": "Scimitar", "type": "scatter", "x": [1180.0], "y": [1.5], "marker": { "size": 15.733333333333333, "color": "rgb(131, 175, 163)" } } trace15 = { "name": "J-type diplomatic barge", "type": "scatter", "x": [2000.0], "y": [0.7], "marker": { "size": 57.142857142857146, "color": "rgb(170, 227, 124)" } } trace16 = { "name": "Jedi starfighter", "type": "scatter", "x": [1150.0], "y": [1.0], "marker": { "size": 23.000000000000004, "color": "rgb(171, 95, 8)" } } trace17 = { "name": "H-type Nubian yacht", "type": "scatter", "x": [8000.0], "y": [0.9], "marker": { "size": 177.77777777777777, "color": "rgb(193, 46, 209)" } } trace18 = { "name": "Star Destroyer", "type": "scatter", "x": [975.0], "y": [2.0], "marker": { "size": 9.75, "color": "rgb(233, 168, 43)" } } trace19 = { "name": "Trade Federation cruiser", "type": "scatter", "x": [1050.0], "y": [1.5], "marker": { "size": 14.000000000000002, "color": "rgb(86, 100, 18)" } } trace20 = { "name": "Theta-class T-2c shuttle", "type": "scatter", "x": [2000.0], "y": [1.0], "marker": { "size": 40.0, "color": "rgb(116, 146, 86)" } } trace21 = { "name": "Rebel transport", "type": "scatter", "x": [650.0], "y": [4.0], "marker": { "size": 3.25, "color": "rgb(48, 22, 160)" } } trace22 = { "name": "Solar Sailer", "type": "scatter", "x": [1600.0], "y": [1.5], "marker": { "size": 21.333333333333332, "color": "rgb(3, 90, 58)" } } trace23 = { "name": "Republic attack cruiser", "type": "scatter", "x": [975.0], "y": [1.0], "marker": { "size": 19.5, "color": "rgb(136, 185, 232)" } } trace24 = { "name": "Naboo star skiff", "type": "scatter", "x": [1050.0], "y": [0.5], "marker": { "size": 42.0, "color": "rgb(163, 253, 246)" } } trace25 = { "name": "Jedi Interceptor", "type": "scatter", "x": [1500.0], "y": [1.0], "marker": { "size": 30.0, "color": "rgb(161, 59, 123)" } } trace26 = { "name": "arc-170", "type": "scatter", "x": [1000.0], "y": [1.0], "marker": { "size": 20.0, "color": "rgb(45, 253, 113)" } } trace27 = { "name": "Belbullab-22 starfighter", "type": "scatter", "x": [1100.0], "y": [6.0], "marker": { "size": 3.666666666666667, "color": "rgb(192, 11, 34)" } } trace28 = { "name": "V-wing", "type": "scatter", "x": [1050.0], "y": [1.0], "marker": { "size": 21.0, "color": "rgb(49, 65, 90)" } } trace29 = { "name": "CR90 corvette", "type": "scatter", "x": [950.0], "y": [2.0], "marker": { "size": 9.5, "color": "rgb(69, 111, 107)" } } data = Data([trace1, trace2, trace3, trace4, trace5, trace6, trace7, trace8, trace9, trace10, trace11, trace12, trace13, trace14, trace15, trace16, trace17, trace18, trace19, trace20, trace21, trace22, trace23, trace24, trace25, trace26, trace27, trace28, trace29]) layout = { "title": "Star Wars API - Spaceships", "xaxis": { "type": "log", "tick0": -1, "title": "Max. atmosphering speed [km/h]", "showgrid": True, "zeroline": False }, "yaxis": { "title": "Hyperdrive rating", "showgrid": True, "zeroline": False }, "showlegend": False } fig = Figure(data=data, layout=layout) plot_url = py.plot(fig)