# Get this figure: fig = py.get_figure("https://plotly.com/~mwarzecha/277/") # Get this figure's data: data = py.get_figure("https://plotly.com/~mwarzecha/277/").get_data() # Add data to this figure: py.plot(Data([Scatter(x=[1, 2], y=[2, 3])]), filename ="% Of candidates that are women, by party", fileopt="extend") # Get y data of first trace: y1 = py.get_figure("https://plotly.com/~mwarzecha/277/").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": "dde989", "name": "NDP", "type": "bar", "x": ["38th election - 2004", "39th election - 2006", "40th election - 2008", "41st election - 2011", "42nd election - As of Sept. 21"], "y": ["31.17%", "35.06%", "33.77%", "40.26%", "43.49%"], "marker": {"color": "rgb(255, 127, 14)"} } trace2 = { "uid": "8a1a2f", "name": "Liberal", "type": "bar", "x": ["38th election - 2004", "39th election - 2006", "40th election - 2008", "41st election - 2011", "42nd election - As of Sept. 21"], "y": ["24.35%", "25.65%", "36.81%", "29.22%", "31.07%"], "marker": {"color": "rgb(255, 0, 0)"} } trace3 = { "uid": "6f0e06", "name": "Bloc Québécois", "type": "bar", "x": ["38th election - 2004", "39th election - 2006", "40th election - 2008", "41st election - 2011", "42nd election - As of Sept. 21"], "y": ["24.00%", "30.67%", "26.67%", "32.00%", "28.57%"], "marker": {"color": "rgb(74, 134, 232)"} } trace4 = { "uid": "0bd721", "name": "Conservatives", "type": "bar", "x": ["38th election - 2004", "39th election - 2006", "40th election - 2008", "41st election - 2011", "42nd election - As of Sept. 21"], "y": ["11.69%", "12.34%", "20.52%", "22.15%", "19.58%"], "marker": {"color": "rgb(0, 0, 255)"} } data = Data([trace1, trace2, trace3, trace4]) layout = { "title": "% Of candidates that are women, by party", "width": 1143, "xaxis": { "type": "category", "range": [-0.5, 4.5], "title": "Click to enter X axis title", "autorange": True }, "yaxis": { "range": [0, 45.77894736842106], "title": "%", "autorange": True }, "height": 607, "autosize": True } fig = Figure(data=data, layout=layout) plot_url = py.plot(fig)