# Get this figure: fig = py.get_figure("https://plotly.com/~empet/6450/") # Get this figure's data: data = py.get_figure("https://plotly.com/~empet/6450/").get_data() # Add data to this figure: py.plot(Data([Scatter(x=[1, 2], y=[2, 3])]), filename ="Prediction-Nomination", fileopt="extend") # Get y data of first trace: y1 = py.get_figure("https://plotly.com/~empet/6450/").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": "", "type": "bar", "x": ["H Clinton", "B Sanders", "J Biden", "O'Malley"], "y": [70, 14, 13, 1], "xaxis": "x1", "yaxis": "y1", "marker": {"color": "#404ca0"} } trace2 = { "name": "", "type": "bar", "x": ["J Bush", "D Trump", "M Rubio", "B Carson", "S Walter", "J Kasich", " C Fiorina", "T Cruz", "M Huckabee", "C Christie", "R Paul"], "y": [36, 16, 13, 9, 8, 5, 4, 3, 3, 1, 1], "xaxis": "x2", "yaxis": "y1", "marker": {"color": "#B0122C"} } trace3 = { "name": "", "type": "bar", "x": ["H Clinton", "B Sanders", "J Biden", "O'Malley"], "y": [69, 12, 17, 0], "xaxis": "x3", "yaxis": "y2", "marker": {"color": "#404ca0"} } trace4 = { "name": "", "type": "bar", "x": ["J Bush", "D Trump", "M Rubio", "B Carson", "S Walter", "J Kasich", " C Fiorina", "T Cruz", "M Huckabee", "C Christie", "R Paul"], "y": [31, 13, 29, 6, 0, 2, 6, 4, 2, 5, 1], "xaxis": "x4", "yaxis": "y2", "marker": {"color": "#B0122C"} } trace5 = { "name": "", "type": "bar", "x": ["H Clinton", "B Sanders", "J Biden", "O'Malley"], "y": [77, 11, 10, 0], "xaxis": "x5", "yaxis": "y3", "marker": {"color": "#404ca0"} } trace6 = { "name": "", "type": "bar", "x": ["J Bush", "D Trump", "M Rubio", "B Carson", "S Walter", "J Kasich", " C Fiorina", "T Cruz", "M Huckabee", "C Christie", "R Paul"], "y": [28, 12, 31, 9, 0, 2, 5, 5, 2, 4, 1], "xaxis": "x6", "yaxis": "y3", "marker": {"color": "#B0122C"} } trace7 = { "name": "", "type": "bar", "x": ["H Clinton", "B Sanders", "J Biden", "O'Malley"], "y": [88, 12, 0, 0], "xaxis": "x7", "yaxis": "y4", "marker": {"color": "#404ca0"} } trace8 = { "name": "", "type": "bar", "x": ["J Bush", "D Trump", "M Rubio", "B Carson", "S Walter", "J Kasich", " C Fiorina", "T Cruz", "M Huckabee", "C Christie", "R Paul"], "y": [11, 20, 41, 11, 0, 2, 2, 7, 1, 4, 0], "xaxis": "x8", "yaxis": "y4", "marker": {"color": "#B0122C"} } data = Data([trace1, trace2, trace3, trace4, trace5, trace6, trace7, trace8]) layout = { "font": {"family": "Open Sans, sans-serif"}, "title": "Political Prediction Markets. Who will win the nomination for presidential election?", "width": 775, "bargap": 0.05, "height": 950, "margin": { "b": 85, "l": 65, "r": 65, "t": 150 }, "xaxis1": { "anchor": "y1", "domain": [0.0, 0.2516], "mirror": False, "showgrid": False, "showline": True, "tickfont": {"size": 10}, "zeroline": False, "tickangle": -45, "showticklabels": True }, "xaxis2": { "anchor": "free", "domain": [0.2816, 1.0], "mirror": False, "position": 0.8250000000000001, "showgrid": False, "showline": True, "tickfont": {"size": 10}, "zeroline": False, "tickangle": -45, "showticklabels": True }, "xaxis3": { "anchor": "y2", "domain": [0.0, 0.2516], "mirror": False, "showgrid": False, "showline": True, "tickfont": {"size": 10}, "zeroline": False, "tickangle": -45, "showticklabels": True }, "xaxis4": { "anchor": "free", "domain": [0.2816, 1.0], "mirror": False, "position": 0.55, "showgrid": False, "showline": True, "tickfont": {"size": 10}, "zeroline": False, "tickangle": -45, "showticklabels": True }, "xaxis5": { "anchor": "y3", "domain": [0.0, 0.2516], "mirror": False, "showgrid": False, "showline": True, "tickfont": {"size": 10}, "zeroline": False, "tickangle": -45, "showticklabels": True }, "xaxis6": { "anchor": "free", "domain": [0.2816, 1.0], "mirror": False, "position": 0.275, "showgrid": False, "showline": True, "tickfont": {"size": 10}, "zeroline": False, "tickangle": -45, "showticklabels": True }, "xaxis7": { "anchor": "y4", "domain": [0.0, 0.2516], "mirror": False, "showgrid": False, "showline": True, "tickfont": {"size": 10}, "zeroline": False, "tickangle": -45, "showticklabels": True }, "xaxis8": { "anchor": "free", "domain": [0.2816, 1.0], "mirror": False, "position": 0.0, "showgrid": False, "showline": True, "tickfont": {"size": 10}, "zeroline": False, "tickangle": -45, "showticklabels": True }, "yaxis1": { "range": [0, 88.2], "title": "%", "anchor": "x1", "domain": [0.8250000000000001, 1.0], "mirror": False, "showgrid": True, "zeroline": False, "gridcolor": "#FFFFFF", "gridwidth": 1, "showticklabels": True }, "yaxis2": { "range": [0, 88.2], "title": "%", "anchor": "x3", "domain": [0.55, 0.7250000000000001], "mirror": False, "showgrid": True, "zeroline": False, "gridcolor": "#FFFFFF", "gridwidth": 1, "showticklabels": True }, "yaxis3": { "range": [0, 88.2], "title": "%", "anchor": "x5", "domain": [0.275, 0.45], "mirror": False, "showgrid": True, "zeroline": False, "gridcolor": "#FFFFFF", "gridwidth": 1, "showticklabels": True }, "yaxis4": { "range": [0, 88.2], "title": "%", "anchor": "x7", "domain": [0.0, 0.175], "mirror": False, "showgrid": True, "zeroline": False, "gridcolor": "#FFFFFF", "gridwidth": 1, "showticklabels": True }, "autosize": False, "hovermode": "x", "showlegend": False, "annotations": [ { "x": 0.14, "y": 1.0, "font": {"size": 12}, "text": "PredictWise Chance of Winning
Democratic Nomination,
September 17, 2015", "xref": "paper", "yref": "paper", "xanchor": "center", "yanchor": "bottom", "showarrow": False }, { "x": 0.6, "y": 1.0, "font": {"size": 12}, "text": "PredictWise Chance of Winning Republican Nomination,
September 17, 2015", "xref": "paper", "yref": "paper", "xanchor": "center", "yanchor": "bottom", "showarrow": False }, { "x": 0.14, "y": 0.725, "font": {"size": 12}, "text": "October 4, 2015", "xref": "paper", "yref": "paper", "xanchor": "center", "yanchor": "bottom", "showarrow": False }, { "x": 0.6, "y": 0.725, "font": {"size": 12}, "text": "October 4, 2015", "xref": "paper", "yref": "paper", "xanchor": "center", "yanchor": "bottom", "showarrow": False }, { "x": 0.14, "y": 0.44999999999999996, "font": {"size": 12}, "text": "October 18, 2015", "xref": "paper", "yref": "paper", "xanchor": "center", "yanchor": "bottom", "showarrow": False }, { "x": 0.6, "y": 0.44999999999999996, "font": {"size": 12}, "text": "October 18, 2015", "xref": "paper", "yref": "paper", "xanchor": "center", "yanchor": "bottom", "showarrow": False }, { "x": 0.14, "y": 0.17499999999999993, "font": {"size": 12}, "text": "October 29, 2015", "xref": "paper", "yref": "paper", "xanchor": "center", "yanchor": "bottom", "showarrow": False }, { "x": 0.6, "y": 0.17499999999999993, "font": {"size": 12}, "text": "October 29, 2015", "xref": "paper", "yref": "paper", "xanchor": "center", "yanchor": "bottom", "showarrow": False }, { "x": 0, "y": -0.12, "font": {"size": 11}, "text": "Data source: [1].", "xref": "paper", "yref": "paper", "xanchor": "left", "yanchor": "bottom", "showarrow": False } ], "plot_bgcolor": "#EFECEA" } fig = Figure(data=data, layout=layout) plot_url = py.plot(fig)