# Get this figure: fig = py.get_figure("https://plotly.com/~EricBerry/180/") # Get this figure's data: data = py.get_figure("https://plotly.com/~EricBerry/180/").get_data() # Add data to this figure: py.plot(Data([Scatter(x=[1, 2], y=[2, 3])]), filename ="Distributions of lengths of consumer reviews of Bounty, Viva, and Brawny", fileopt="extend") # Get x data of first trace: x1 = py.get_figure("https://plotly.com/~EricBerry/180/").get_data()[0]["x"] # 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": "63ecfb", "name": "Viva Mainline", "type": "histogram", "x": ["15", "45", "12", "21", "84", "34", "87", "18", "12", "18", "14", "16", "20", "17", "76", "94", "16", "14", "11", "26", "19", "20", "12", "27", "35", "27", "31", "54", "14", "27", "11", "10", "14", "27", "13", "52", "13", "24", "18", "70", "24", "10", "16", "24", "15", "25", "36", "22", "32", "12", "32", "12", "16", "20", "33", "49", "12", "42", "9", "14", "20", "12", "15", "19", "36", "17", "30", "39", "15", "40", "37", "22", "22", "32", "12", "12", "21", "15", "23", "24", "39", "16", "13", "16", "115", "23", "21", "46", "12", "23", "31", "20", "14", "26", "58", "131", "34", "97", "108", "51", "24", "108", "15", "34", "47", "59", "44", "65", "17", "9", "104", "15", "9", "89", "29", "51", "17", "59", "29", "65", "41", "125", "92", "29", "17", "38", "24", "61", "13", "27", "18", "32", "41", "9", "50", "65", "94", "16", "50", "67", "94", "110", "16", "21", "76", "56", "143", "22", "66", "82", "87", "12", "64", "156", "14", "129", "84", "70", "91", "58", "43", "68", "18", "38", "48", "26", "21", "13", "12", "29", "25", "12", "53", "12", "10", "37", "19", "16", "14", "13", "10", "11", "28", "9", "34", "32", "13", "17", "72", "50", "11", "67", "40", "14", "53", "43", "43", "12", "12", "18", "27", "18", "152", "45", "98", "15", "66", "95", "76", "99", "13", "108", "78", "63", "180", "82", "42", "183", "126", "28"], "xbins": { "end": 189.5, "size": 7, "start": 4.5 }, "marker": { "line": { "color": "#444", "width": 0.8 }, "color": "rgb(227, 119, 194)" }, "opacity": 1, "autobinx": False, "histnorm": "" } trace2 = { "uid": "9d2686", "name": "Vantage", "type": "histogram", "x": ["10", "24", "32", "42", "83", "25", "29", "15", "64", "19", "14", "24", "16", "41", "29", "10", "27", "29", "16", "10", "12", "22", "20", "21", "61", "91", "46", "62", "12", "11", "29", "18", "19", "43", "14", "18", "19", "10", "11", "13", "20", "28", "42", "9", "28", "11", "30", "13", "12", "21", "26", "10", "23", "20", "27", "10", "10", "24", "17", "54", "12", "17", "27", "28", "14", "36", "71", "15", "80", "11", "10", "30", "14", "16", "18", "80", "15", "10", "9", "19", "19", "10", "51", "49", "41", "46", "47", "31", "27", "16", "18", "6", "24", "65", "34", "14", "23", "31", "9", "22", "58", "13", "24", "28", "11", "25", "16", "37", "20", "12", "27", "56", "28", "10", "57", "10", "114", "10", "10", "14", "11", "18", "31", "36", "17", "21", "10", "26", "23", "11", "25", "19", "12", "13", "36", "11", "62", "50", "34", "10", "43", "12", "11", "18", "19", "31", "21", "21", "19", "23", "11", "10", "11", "21", "27", "28", "12", "31", "30", "10", "20", "10", "12", "12", "36", "35", "24", "22", "9", "13", "9", "19", "37", "33", "14", "12", "16", "14", "28", "54", "37", "13", "31", "34", "13", "19", "20", "10", "17", "45", "11", "16", "13", "10", "17", "10", "11", "20", "40", "21", "11", "25", "17", "14", "28", "14", "17", "23", "11", "37", "67", "21", "14", "14", "14", "20", "19", "47", "12", "17", "16", "38", "15", "18"], "xbins": { "end": 114.5, "size": 7, "start": 4.5 }, "marker": { "line": { "color": "#444", "width": 0.8 }, "color": "rgb(148, 103, 189)" }, "opacity": 1, "autobinx": False, "histnorm": "" } trace3 = { "uid": "55f011", "name": "Brawny", "type": "histogram", "x": ["40", "40", "25", "30", "24", "12", "33", "15", "38", "31", "14", "11", "16", "9", "40", "14", "15", "11", "50", "59", "24", "18", "11", "12", "13", "10", "9", "11", "8", "19", "23", "43", "47", "14", "31", "29", "33", "11", "19", "21", "10", "10", "54", "17", "15", "26", "20", "9", "34", "21", "21", "12", "34", "12", "19", "16", "14", "8", "54", "39", "8", "30", "15", "25", "11", "17", "22", "30", "12", "11", "13", "11", "20", "10", "13", "10", "13", "13", "16", "12", "12", "13", "41", "10", "21", "11", "8", "33", "26", "15", "22", "22", "26", "18", "15", "12", "16", "14", "12", "9", "10", "7", "14", "13", "15", "39", "14", "63", "15", "12", "13", "12", "57", "15", "16", "10", "13", "10", "12", "10", "12", "23", "12", "12", "32", "11", "18", "24", "10", "13", "16", "28", "20", "13", "11", "16", "11", "11", "16", "15", "30", "16", "19", "10", "13", "8", "106", "15", "25", "15", "12", "14", "86", "23", "32", "20", "57", "10", "32", "17", "19", "112", "19", "13", "11", "38", "16", "67", "43", "29", "55", "67", "57", "51", "84", "54", "29", "30", "18", "75", "34", "59", "15", "23", "22", "75", "48", "20", "13", "37", "18", "40", "65", "9", "22", "13", "11", "54", "38", "8", "77", "31", "11", "65", "70", "73", "55", "22", "106", "27", "15", "9", "18", "28", "45", "14", "31", "27", "34", "10", "10", "27", "9", "9", "31"], "xbins": { "end": 114.5, "size": 7, "start": 4.5 }, "marker": { "line": { "color": "black", "width": 0.8 }, "color": "rgb(255, 0, 0)" }, "opacity": 0.7, "autobinx": False } trace4 = { "uid": "38c282", "name": "Bounty", "type": "histogram", "x": ["90", "96", "66", "100", "80", "86", "86", "137", "181", "59", "66", "85", "87", "82", "51", "36", "115", "180", "80", "24", "28", "86", "84", "116", "76", "82", "58", "32", "84", "49", "60", "90", "99", "177", "46", "30", "30", "10", "19", "101", "54", "138", "66", "46", "59", "31", "67", "115", "175", "52", "62", "43", "70", "100", "124", "36", "46", "19", "9", "14", "24", "131", "39", "37", "21", "61", "71", "64", "54", "43", "25", "45", "18", "54", "26", "134", "15", "33", "27", "34", "33", "18", "33", "44", "11", "30", "21", "41", "53", "61", "43", "30", "28", "86", "60", "76", "32", "59", "40", "32", "41", "26", "63", "12", "59", "10", "31", "34", "43", "20", "39", "32", "34", "23", "21", "27", "26", "40", "30", "37", "15", "14", "19", "35", "14", "18", "17", "63", "24", "10", "69", "14", "10", "11", "81", "46", "42", "17", "66", "23", "24", "21", "15", "73", "42", "77", "22", "65", "16", "9", "19", "25", "27", "12", "35", "25", "39", "50", "69", "70", "18", "33", "33", "42", "119", "65", "14", "21", "66", "117", "32", "22", "49", "31", "21", "33", "32", "11", "49", "31", "17", "37", "47", "86", "102", "19", "159", "25", "27", "122", "37", "16", "78", "36", "63", "65", "25", "41", "102", "81", "141", "36", "41", "71", "37", "85", "76", "107", "41", "58", "136", "52", "86", "86", "44", "88", "19", "120", "66", "159", "40", "10", "17", "100"], "xbins": { "end": 189.5, "size": 7, "start": -0.5 }, "marker": { "line": { "color": "black", "width": 0.8 }, "color": "rgba(44, 160, 44, 0.59)" }, "opacity": 0.7, "autobinx": False } data = Data([trace1, trace2, trace3, trace4]) layout = { "font": { "size": 12, "color": "#444", "family": "\"Open sans\", verdana, arial, sans-serif" }, "title": "Distributions of lengths of consumer reviews of Bounty, Viva, and Brawny", "width": 827, "xaxis": { "type": "linear", "range": [4.5, 186.5], "ticks": "", "title": "Number of words", "mirror": False, "nticks": 0, "ticklen": 6, "showgrid": True, "showline": False, "tickfont": { "size": 12, "color": "#444", "family": "\"Open sans\", verdana, arial, sans-serif" }, "tickmode": "auto", "zeroline": False, "autorange": True, "gridcolor": "rgb(255, 255, 255)", "gridwidth": 2, "linecolor": "rgba(152, 0, 0, 0.5)", "linewidth": 1.5, "rangemode": "normal", "tickangle": "auto", "tickcolor": "rgba(0, 0, 0, 0)", "titlefont": { "size": 14, "color": "#444", "family": "\"Open sans\", verdana, arial, sans-serif" }, "showexponent": "all", "zerolinewidth": 1, "exponentformat": "B", "showticklabels": True }, "yaxis": { "type": "linear", "range": [-3.1976638072640995, 77.01040335827706], "ticks": "", "title": "Number of reviews", "mirror": False, "nticks": 0, "ticklen": 6, "showgrid": True, "showline": False, "tickfont": { "size": 12, "color": "#444", "family": "\"Open sans\", verdana, arial, sans-serif" }, "tickmode": "auto", "zeroline": False, "autorange": True, "gridcolor": "rgb(255, 255, 255)", "gridwidth": 2, "linecolor": "rgba(152, 0, 0, 0.5)", "linewidth": 1.5, "rangemode": "normal", "tickangle": "auto", "tickcolor": "rgba(0, 0, 0, 0)", "titlefont": { "size": 14, "color": "#444", "family": "\"Open sans\", verdana, arial, sans-serif" }, "showexponent": "all", "zerolinewidth": 1, "exponentformat": "B", "showticklabels": True }, "bargap": 0, "height": 481, "legend": { "x": 0.7978883861236803, "y": 0.9634551495016611, "font": { "size": 12, "color": "#444", "family": "\"Open sans\", verdana, arial, sans-serif" }, "bgcolor": "rgba(255, 255, 255, 0.75)", "traceorder": "normal", "bordercolor": "rgba(0, 0, 0, 0)", "borderwidth": 1 }, "barmode": "overlay", "autosize": True, "dragmode": "zoom", "hovermode": "x", "titlefont": { "size": 17, "color": "#444", "family": "\"Open sans\", verdana, arial, sans-serif" }, "separators": ".,", "showlegend": True, "annotations": [ { "x": 42, "y": 0, "ax": 0, "ay": -290, "text": "", "arrowhead": 0, "arrowcolor": "rgb(44, 160, 44)", "arrowwidth": 4 }, { "x": 27, "y": 0, "ax": 0, "ay": -290, "text": "", "arrowhead": 0, "arrowcolor": "rgb(227, 119, 194)", "arrowwidth": 4 }, { "x": 19, "y": 0, "ax": 0, "ay": -290, "text": "", "arrowhead": 0, "arrowcolor": "rgb(148, 103, 189)", "arrowwidth": 4 }, { "x": 17, "y": 0, "ax": 0, "ay": -290, "text": "", "arrowhead": 0, "arrowcolor": "rgb(255, 0, 0)", "arrowwidth": 4 }, { "x": 69, "y": 72, "ax": 0, "ay": 0, "font": {"color": "rgb(44, 160, 44)"}, "text": "Median Bounty review: 42 words", "arrowhead": 0, "arrowcolor": "rgb(44, 160, 44)" }, { "x": 70, "y": 67, "ax": 0, "ay": 0, "font": {"color": "rgb(227, 119, 194)"}, "text": "Median Mainline review: 27 words" }, { "x": 70, "y": 62, "ax": 0, "ay": 0, "font": {"color": "rgb(148, 103, 189)"}, "text": "Median Vantage review: 19 words" }, { "x": 69, "y": 57, "ax": 0, "ay": 0, "font": {"color": "rgb(255, 0, 0)"}, "text": "Median Brawny review: 17 words" } ], "bargroupgap": 0.2, "hidesources": False, "plot_bgcolor": "rgb(245, 245, 245)", "paper_bgcolor": "#fff" } fig = Figure(data=data, layout=layout) plot_url = py.plot(fig)