# Get this figure: fig = py.get_figure("https://plotly.com/~TonyFast/4/") # Get this figure's data: data = py.get_figure("https://plotly.com/~TonyFast/4/").get_data() # Add data to this figure: py.plot(Data([Scatter(x=[1, 2], y=[2, 3])]), filename ="plot from API (4)", fileopt="extend") # Get y data of first trace: y1 = py.get_figure("https://plotly.com/~TonyFast/4/").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 = { "uid": "371f4f", "line": { "color": "", "width": 0 }, "name": "15", "type": "scatter", "x": [-0.0111291, -0.02751725, -0.03017277, -0.03011172, -0.02926798, -0.03643525, -0.03101163, -0.01782965, -0.01778263], "y": [0.01956448, 0.03078252, 0.0615735, 0.04791931, 0.1002016, 0.1217657, -0.07362801, 0.05789031, 0.005436112], "marker": { "line": { "color": "black", "width": 3 }, "size": 16, "color": "rgb(166,206,227)", "symbol": "circle", "opacity": 0.9 }, "error_x": }, "error_y": }, "textfont": } } trace2 = { "uid": "9eca37", "line": { "color": "", "width": 0 }, "name": "23", "type": "scatter", "x": [-0.09085062, -0.08309718, -0.07721143, -0.08032169, -0.08266671, -0.09760333, -0.08919488, -0.1067082, -0.08262652], "y": [0.009362979, -0.03449371, -0.2519982, -0.02016662, -0.01193892, -0.04754519, -0.07898571, 0.002751064, -0.02970496], "marker": { "line": { "color": "black", "width": 3 }, "size": 16, "color": "rgb(48,131,208)", "symbol": "circle", "opacity": 0.9 }, "error_x": }, "error_y": }, "textfont": } } trace3 = { "uid": "767b9b", "line": { "color": "", "width": 0 }, "name": "HT11", "type": "scatter", "x": [-0.1415569, -0.1494909, -0.1395377, -0.1530695, -0.1347388, -0.1530795, -0.128468, -0.148947, -0.1332723], "y": [-0.02640657, -0.01860438, -0.04419354, -0.09782245, -0.03567848, -0.02751839, -0.02723736, 0.001900022, -0.01007051], "marker": { "line": { "color": "black", "width": 3 }, "size": 16, "color": "rgb(31,120,180)", "symbol": "circle", "opacity": 0.9 }, "error_x": }, "error_y": }, "textfont": } } trace4 = { "uid": "92d40d", "line": { "color": "", "width": 0 }, "name": "HT14", "type": "scatter", "x": [-0.04738642, -0.0008138246, 0.00239608, -0.05681301, -0.001531539, -0.01619036, -0.01471195, -0.07534351, -0.05924579], "y": [0.1217286, 0.06880765, 0.06987558, 0.0923118, 0.07917621, 0.1020779, 0.07510775, 0.1260983, 0.1034498], "marker": { "line": { "color": "black", "width": 3 }, "size": 16, "color": "rgb(178,223,138)", "symbol": "circle", "opacity": 0.9 }, "error_x": }, "error_y": }, "textfont": } } trace5 = { "uid": "f653d0", "line": { "color": "", "width": 0 }, "name": "HT20", "type": "scatter", "x": [-0.05800647, -0.05174312, -0.06917382, -0.06278965], "y": [0.1071245, 0.0822339, 0.06373747, 0.1062265], "marker": { "line": { "color": "black", "width": 3 }, "size": 16, "color": "rgb(115,193,80)", "symbol": "circle", "opacity": 0.9 }, "error_x": }, "error_y": }, "textfont": } } trace6 = { "uid": "8045e8", "line": { "color": "", "width": 0 }, "name": "HT22", "type": "scatter", "x": [0.1019851, 0.09534021, 0.0832851, 0.1062007], "y": [0.07468498, 0.06731757, 0.1172952, 0.03836456], "marker": { "line": { "color": "black", "width": 3 }, "size": 16, "color": "rgb(51,160,44)", "symbol": "circle", "opacity": 0.9 }, "error_x": }, "error_y": }, "textfont": } } trace7 = { "uid": "eb57e4", "line": { "color": "", "width": 0 }, "name": "HT27", "type": "scatter", "x": [-0.02251035, -0.01762548, -0.01399149, -0.009987589, -0.01960819, -0.02769381, -0.0205609, -0.02353862, -0.02974976], "y": [0.1113681, 0.1244515, 0.1211026, 0.1400648, 0.1057393, 0.1128777, 0.09368854, 0.1128864, 0.04781158], "marker": { "line": { "color": "black", "width": 3 }, "size": 16, "color": "rgb(151,157,99)", "symbol": "circle", "opacity": 0.9 }, "error_x": }, "error_y": }, "textfont": } } trace8 = { "uid": "daa855", "line": { "color": "", "width": 0 }, "name": "HT28", "type": "scatter", "x": [0.09666203, 0.09268733, 0.09030964, 0.1075584, 0.08567151, 0.0898931, 0.09666203, 0.09268733, 0.09030964, 0.1075584], "y": [0.02999132, 0.0498491, 0.066603, 0.03246903, -0.03135056, 0.06054206, 0.02999132, 0.0498491, 0.066603, 0.03246903], "marker": { "line": { "color": "black", "width": 3 }, "size": 16, "color": "rgb(251,154,153)", "symbol": "circle", "opacity": 0.9 }, "error_x": }, "error_y": }, "textfont": } } trace9 = { "uid": "8141d8", "line": { "color": "", "width": 0 }, "name": "HT30", "type": "scatter", "x": [-0.06509734, -0.06494372, -0.08067137, -0.06270091, -0.03518021, -0.08299951, -0.07570164, -0.1064576, -0.06322916], "y": [-0.04945242, 0.06573995, 0.07370412, 0.05268428, -0.03587492, 0.05973246, 0.08811882, 0.09473722, 0.06372659], "marker": { "line": { "color": "black", "width": 3 }, "size": 16, "color": "rgb(239,89,91)", "symbol": "circle", "opacity": 0.9 }, "error_x": }, "error_y": }, "textfont": } } trace10 = { "uid": "0f0698", "line": { "color": "", "width": 0 }, "name": "HT31", "type": "scatter", "x": [0.1478522, 0.1376083, 0.1441146, 0.1392803, 0.1403174, 0.1438648, 0.1418454, 0.128618, 0.1053778], "y": [-0.0697895, -0.0177304, -0.0768396, -0.04160454, -0.04648636, -0.05136625, -0.09609146, -0.04948872, -0.03838844], "marker": { "line": { "color": "black", "width": 3 }, "size": 16, "color": "rgb(227,26,28)", "symbol": "circle", "opacity": 0.9 }, "error_x": }, "error_y": }, "textfont": } } trace11 = { "uid": "abd7f9", "line": { "color": "", "width": 0 }, "name": "HT34", "type": "scatter", "x": [0.1862432, 0.2037513, 0.1753054, 0.2067631, 0.2016863, 0.1624851, 0.1387403, 0.2117341, 0.1815393], "y": [-0.08245619, -0.04599707, -0.05031403, -0.02717363, -0.03097138, -0.05963156, -0.1529083, -0.02725985, -0.04598003], "marker": { "line": { "color": "black", "width": 3 }, "size": 16, "color": "rgb(253,191,111)", "symbol": "circle", "opacity": 0.9 }, "error_x": }, "error_y": }, "textfont": } } trace12 = { "uid": "e48986", "line": { "color": "", "width": 0 }, "name": "HT35", "type": "scatter", "x": [-0.08369773, -0.06086555, -0.1021769, -0.07153702, -0.05783174, -0.0609265, -0.02660314, -0.02330994, -0.1096888], "y": [-0.1974198, -0.2820493, -0.4344143, -0.1354647, -0.1314372, -0.2395455, -0.1229908, -0.2374365, -0.09766052], "marker": { "line": { "color": "black", "width": 3 }, "size": 16, "color": "rgb(255,159,56)", "symbol": "circle", "opacity": 0.9 }, "error_x": }, "error_y": }, "textfont": } } data = Data([trace1, trace2, trace3, trace4, trace5, trace6, trace7, trace8, trace9, trace10, trace11, trace12]) layout = { "font": { "size": 12, "color": "#000", "family": "'Open sans', verdana, arial, sans-serif" }, "smith": False, "title": "Principal Components Analysis of the Spatial Statistics of alpha-beta Titanium Topology", "width": 1296, "xaxis": { "type": "linear", "dtick": 0.05, "range": [-0.17334692222222223, 0.23200152222222223], "tick0": 0, "ticks": "outside", "title": "First Principal Components", "anchor": "y", "domain": [0, 1], "mirror": "all", "nticks": 0, "ticklen": 5, "autotick": True, "position": 0, "showgrid": True, "showline": True, "tickfont": { "size": 0, "color": "", "family": "" }, "zeroline": True, "autorange": True, "gridcolor": "#ddd", "gridwidth": 1, "linecolor": "#000", "linewidth": 1, "rangemode": "normal", "tickangle": "auto", "tickcolor": "#000", "tickwidth": 1, "titlefont": { "size": 0, "color": "", "family": "" }, "overlaying": False, "showexponent": "all", "zerolinecolor": "#000", "zerolinewidth": 1, "exponentformat": "e", "showticklabels": True }, "yaxis": { "type": "linear", "dtick": 0.1, "range": [-0.46632980555555553, 0.17198030555555555], "tick0": 0, "ticks": "outside", "title": "Second Principal Components", "anchor": "x", "domain": [0, 1], "mirror": "all", "nticks": 0, "ticklen": 5, "autotick": True, "position": 0, "showgrid": True, "showline": True, "tickfont": { "size": 0, "color": "", "family": "" }, "zeroline": True, "autorange": True, "gridcolor": "#ddd", "gridwidth": 1, "linecolor": "#000", "linewidth": 1, "rangemode": "normal", "tickangle": "auto", "tickcolor": "#000", "tickwidth": 1, "titlefont": { "size": 0, "color": "", "family": "" }, "overlaying": False, "showexponent": "all", "zerolinecolor": "#000", "zerolinewidth": 1, "exponentformat": "e", "showticklabels": True }, "bargap": 0.2, "boxgap": 0.3, "height": 432, "legend": { "x": 0.98, "y": 0.98, "font": { "size": 0, "color": "", "family": "" }, "bgcolor": "#fff", "xanchor": "auto", "yanchor": "auto", "traceorder": "normal", "bordercolor": "#000", "borderwidth": 1 }, "margin": { "b": 80, "l": 80, "r": 80, "t": 100, "pad": 2, "autoexpand": True }, "barmode": "stack", "boxmode": "overlay", "autosize": True, "dragmode": "zoom", "hovermode": "x", "titlefont": { "size": 0, "color": "", "family": "" }, "separators": ".,", "showlegend": True, "bargroupgap": 0, "boxgroupgap": 0.3, "hidesources": False, "plot_bgcolor": "#fff", "paper_bgcolor": "#fff" } fig = Figure(data=data, layout=layout) plot_url = py.plot(fig)