# Get this figure: fig = py.get_figure("https://plotly.com/~snawel/80/") # Get this figure's data: data = py.get_figure("https://plotly.com/~snawel/80/").get_data() # Add data to this figure: py.plot(Data([Scatter(x=[1, 2], y=[2, 3])]), filename ="plot from API (31)", fileopt="extend") # Get y data of first trace: y1 = py.get_figure("https://plotly.com/~snawel/80/").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 = { "type": "heatmap", "x": ["Lexus", "unknown", "Mercedes", "BMW", "Audi", "Toyota", "Acura", "Honda", "Tesla", "Infiniti", "Volkswagen", "Ford", "Hyundai", "Porsche", "Chevrolet", "Gmc", "Dodge", "Buick", "Subaru", "Cadillac", "Mini", "Volvo", "Chrysler", "Other", "Nissan", "Lincoln", "Kia", "Don't Know"], "y": ["Volkswagen", "Land Rover", "Dodge", "Jaguar", "Range Rover", "Buick", "Porsche", "Other", "Jeep", "Hyundai", "Don't Know", "Nissan", "Subaru", "Lincoln", "Infiniti", "Tesla", "Cadillac", "Chevrolet", "Ford", "Toyota", "Honda", "Audi", "Mercedes", "Acura", "Lexus", "BMW", "unknown"], "z": [ [0.0, 0.0, 0.020833333333333332, 0.034482758620689655, 0.0, 0.0, 0.02857142857142857, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.041666666666666664, 0.0, 0.0, 0.0, 0.0, 0.0, None, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, None, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.011494252873563218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.05357142857142857, 0.0, 0.0, 0.041666666666666664, 0.0, 0.0, 0.0, 0.0, 0.0, None, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.08571428571428572, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.06896551724137931, None, 0.0, 0.0, 0.0, 0.08333333333333333, 0.0, 0.0, 0.0], [None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None], [0.011764705882352941, 0.0, 0.0, 0.0, 0.0425531914893617, 0.07462686567164178, 0.0, 0.0, 0.17647058823529413, 0.0, 0.0, 0.03571428571428571, 0.17647058823529413, 0.0, 0.2916666666666667, 0.0, 0.15, 0.0, 0.0, 0.0, None, 0.0, 1.0, 0.0, 0.0, 0.0, 0.16666666666666666, 0.0], [0.0, 0.0, 0.020833333333333332, 0.034482758620689655, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.06896551724137931, None, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.020833333333333332, 0.0, 0.0425531914893617, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, None, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.15, 0.13333333333333333, 0.0, 0.0, None, 0.0, 0.0, 0.16666666666666666, 0.0, 0.0, 0.0, 0.0], [0.03529411764705882, 0.0, 0.0, 0.022988505747126436, 0.0, 0.07462686567164178, 0.02857142857142857, 0.0, 0.0, 0.0, 0.125, 0.017857142857142856, 0.0, 0.0, 0.125, 0.0, 0.1, 0.0, 0.0, 0.0, None, 0.0, 0.0, 0.0, 0.20833333333333334, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, None, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.8571428571428571], [0.023529411764705882, 0.0, 0.041666666666666664, 0.022988505747126436, 0.0425531914893617, 0.029850746268656716, 0.0, 0.0, 0.0, 0.10714285714285714, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, None, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.022988505747126436, 0.0, 0.04477611940298507, 0.0, 0.0, 0.0, 0.0, 0.125, 0.0, 0.0, 0.0, 0.08333333333333333, 0.0, 0.0, 0.0, 0.0, 0.0, None, 0.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.041666666666666664, 0.04597701149425287, 0.0, 0.0, 0.0, 0.03571428571428571, 0.0, 0.0, 0.0, 0.08928571428571429, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.10344827586206896, None, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.10588235294117647, 0.0, 0.0, 0.04597701149425287, 0.0425531914893617, 0.0, 0.05714285714285714, 0.017857142857142856, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, None, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.011764705882352941, 0.0, 0.0, 0.05747126436781609, 0.0, 0.029850746268656716, 0.02857142857142857, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.06896551724137931, None, 0.0, 0.0, 0.0, 0.08333333333333333, 0.13333333333333333, 0.0, 0.0], [0.058823529411764705, 0.0, 0.0, 0.05747126436781609, 0.0, 0.0, 0.0, 0.0, 0.0, 0.07142857142857142, 0.0, 0.0, 0.17647058823529413, 0.0, 0.0, 0.0, 0.15, 0.0, 0.0, 0.0, None, 0.0, 0.0, 0.0, 0.0, 0.13333333333333333, 0.0, 0.0], [0.011764705882352941, 0.0, 0.0, 0.0, 0.0, 0.04477611940298507, 0.0, 0.03571428571428571, 0.0, 0.0, 0.0, 0.08928571428571429, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, None, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.023529411764705882, 0.0, 0.0, 0.011494252873563218, 0.06382978723404255, 0.08955223880597014, 0.0, 0.05357142857142857, 0.23529411764705882, 0.0, 0.0, 0.0, 0.11764705882352941, 0.0, 0.20833333333333334, 0.0, 0.15, 0.3333333333333333, 0.0, 0.0, None, 0.0, 0.0, 0.0, 0.08333333333333333, 0.0, 0.3333333333333333, 0.0], [0.21176470588235294, 0.038461538461538464, 0.041666666666666664, 0.04597701149425287, 0.0425531914893617, 0.0, 0.05714285714285714, 0.21428571428571427, 0.0, 0.0, 0.0, 0.14285714285714285, 0.23529411764705882, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.10344827586206896, None, 0.0, 0.0, 0.3333333333333333, 0.16666666666666666, 0.0, 0.16666666666666666, 0.0], [0.03529411764705882, 0.0, 0.0, 0.04597701149425287, 0.0425531914893617, 0.07462686567164178, 0.0, 0.0, 0.0, 0.07142857142857142, 0.0, 0.19642857142857142, 0.17647058823529413, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2, 0.034482758620689655, None, 0.2, 0.0, 0.0, 0.041666666666666664, 0.0, 0.16666666666666666, 0.0], [0.047058823529411764, 0.0, 0.10416666666666667, 0.1724137931034483, 0.02127659574468085, 0.0, 0.17142857142857143, 0.017857142857142856, 0.0, 0.10714285714285714, 0.125, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.06666666666666667, 0.0, 0.0, None, 0.0, 0.0, 0.16666666666666666, 0.125, 0.0, 0.0, 0.0], [0.12941176470588237, 0.0, 0.0, 0.14942528735632185, 0.06382978723404255, 0.0, 0.08571428571428572, 0.03571428571428571, 0.11764705882352941, 0.03571428571428571, 0.0, 0.08928571428571429, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.13793103448275862, None, 0.2, 0.0, 0.16666666666666666, 0.125, 0.06666666666666667, 0.0, 0.0], [0.1411764705882353, 0.0, 0.08333333333333333, 0.022988505747126436, 0.0851063829787234, 0.029850746268656716, 0.0, 0.16071428571428573, 0.0, 0.10714285714285714, 0.0, 0.0, 0.058823529411764705, 0.0, 0.16666666666666666, 0.0, 0.0, 0.0, 0.2, 0.10344827586206896, None, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.14285714285714285], [0.023529411764705882, 0.0, 0.25, 0.14942528735632185, 0.1702127659574468, 0.29850746268656714, 0.34285714285714286, 0.17857142857142858, 0.17647058823529413, 0.42857142857142855, 0.0, 0.05357142857142857, 0.0, 0.0, 0.041666666666666664, 0.0, 0.0, 0.13333333333333333, 0.1, 0.20689655172413793, None, 0.2, 0.0, 0.16666666666666666, 0.041666666666666664, 0.26666666666666666, 0.16666666666666666, 0.0], [0.10588235294117647, 0.0, 0.375, 0.034482758620689655, 0.3191489361702128, 0.1791044776119403, 0.11428571428571428, 0.25, 0.29411764705882354, 0.0, 0.4375, 0.05357142857142857, 0.058823529411764705, 0.0, 0.0, 0.6666666666666666, 0.05, 0.2, 0.0, 0.0, None, 0.2, 0.0, 0.0, 0.041666666666666664, 0.26666666666666666, 0.0, 0.0], [0.0, 0.9615384615384616, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, None, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.], "colorbar": { "x": 0.99, "y": 0.35, "len": 0.75, "thickness": 15 }, "colorscale": "Greens", "reversescale": True } trace2 = { "name": "BF1_1: First Choice", "type": "bar", "x": ["Lexus", "unknown", "Mercedes", "BMW", "Audi", "Toyota", "Acura", "Honda", "Tesla", "Infiniti", "Volkswagen", "Ford", "Hyundai", "Porsche", "Chevrolet", "Gmc", "Dodge", "Buick", "Subaru", "Cadillac", "Mini", "Volvo", "Chrysler", "Other", "Nissan", "Lincoln", "Kia", "Don't Know"], "y": [0.1746987951807229, 0.15060240963855423, 0.1144578313253012, 0.0963855421686747, 0.08433734939759036, 0.06626506024096386, 0.04819277108433735, 0.03614457831325301, 0.030120481927710843, 0.024096385542168676, 0.024096385542168676, 0.018072289156626505, 0.018072289156626505, 0.012048192771084338, 0.012048192771084338, 0.012048192771084338, 0.012048192771084338, 0.006024096385542169, 0.006024096385542169, 0.006024096385542169, 0.006024096385542169, 0.006024096385542169, 0.006024096385542169, 0.006024096385542169, 0.006024096385542169, 0.006024096385542169, 0.006024096385542169, 0.006024096385542169], "xaxis": "x1", "yaxis": "y2" } trace3 = { "name": "BF1_2: Second Choice", "type": "bar", "x": [0.1566265060240964, 0.14457831325301204, 0.10843373493975904, 0.0783132530120482, 0.07228915662650602, 0.060240963855421686, 0.05421686746987952, 0.04216867469879518, 0.03614457831325301, 0.030120481927710843, 0.030120481927710843, 0.024096385542168676, 0.018072289156626505, 0.018072289156626505, 0.018072289156626505, 0.018072289156626505, 0.012048192771084338, 0.012048192771084338, 0.012048192771084338, 0.012048192771084338, 0.006024096385542169, 0.006024096385542169, 0.006024096385542169, 0.006024096385542169, 0.006024096385542169, 0.006024096385542169, 0.006024096385542169], "y": ["unknown", "BMW", "Lexus", "Acura", "Mercedes", "Audi", "Honda", "Toyota", "Ford", "Chevrolet", "Cadillac", "Tesla", "Infiniti", "Lincoln", "Subaru", "Nissan", "Don't Know", "Hyundai", "Jeep", "Other", "Porsche", "Buick", "Range Rover", "Jaguar", "Dodge", "Land Rover", "Volkswagen"], "xaxis": "x2", "yaxis": "y1", "orientation": "h" } data = Data([trace1, trace2, trace3]) layout = { "font": { "size": 9, "family": "PT Sans Narrow, sans-serif" }, "title": "brand choices for age <60", "xaxis": { "title": "BF1_1: First Choice", "domain": [0, 0.75], "zeroline": True }, "yaxis": { "title": "BF1_2: Second Choice", "domain": [0, 0.75], "zeroline": True }, "xaxis2": {"domain": [0.8, 1]}, "yaxis2": {"domain": [0.8, 1]} } fig = Figure(data=data, layout=layout) plot_url = py.plot(fig)