# Get this figure: fig = py.get_figure("https://plotly.com/~jackp/8527/") # Get this figure's data: data = py.get_figure("https://plotly.com/~jackp/8527/").get_data() # Add data to this figure: py.plot(Data([Scatter(x=[1, 2], y=[2, 3])]), filename ="d3-world-map", fileopt="extend") # Get z data of first trace: z1 = py.get_figure("https://plotly.com/~jackp/8527/").get_data()[0]["z"] # 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": "Layer 1", "type": "choropleth", "z": [21.71, 13.4, 227.8, 0.75, 4.8, 131.4, 0.18, 1.24, 536.2, 10.88, 2.52, 1483.0, 436.1, 77.91, 8.65, 34.05, 186.6, 4.28, 75.25, 527.8, 1.67, 9.24, 5.2, 2.09, 34.08, 19.55, 16.3, 2244.0, 1.1, 17.43, 55.08, 13.38, 65.29, 3.04, 1.98, 16.9, 32.16, 1794.0, 2.25, 1.73, 15.84, 264.1, 10360.0, 400.1, 0.72, 32.67, 14.11, 0.18, 50.46, 33.96, 57.18, 77.15, 5.6, 21.34, 205.6, 347.2, 1.58, 0.51, 64.05, 100.5, 284.9, 25.14, 15.4, 3.87, 26.36, 49.86, 0.16, 2.32, 4.17, 276.3, 2902.0, 7.15, 20.68, 0.92, 16.13, 3820.0, 35.48, 1.85, 246.4, 2.16, 0.84, 4.6, 58.3, 2.74, 1.04, 6.77, 3.14, 8.92, 19.37, 292.7, 129.7, 16.2, 2048.0, 856.1, 402.7, 232.2, 245.8, 4.08, 305.0, 2129.0, 13.92, 4770.0, 5.77, 36.55, 225.6, 62.72, 0.16, 28.0, 1410.0, 5.99, 179.3, 7.65, 11.71, 32.82, 47.5, 2.46, 2.07, 49.34, 5.11, 48.72, 63.93, 51.68, 10.92, 11.19, 4.41, 336.9, 2.41, 12.04, 10.57, 0.18, 4.29, 12.72, 1296.0, 0.34, 7.74, 6.06, 11.73, 4.66, 112.6, 16.59, 13.11, 19.64, 880.4, 11.1, 201.0, 11.85, 594.3, 8.29, 0.01, 1.23, 511.6, 80.54, 237.5, 0.65, 44.69, 16.1, 31.3, 208.2, 284.6, 552.2, 228.2, 93.52, 212.0, 199.0, 2057.0, 8.0, 0.81, 1.35, 0.56, 0.22, 0.75, 0.83, 1.86, 0.36, 777.9, 15.88, 42.65, 1.47, 5.41, 307.9, 304.1, 99.75, 49.93, 1.16, 2.37, 341.2, 11.89, 1400.0, 71.57, 70.03, 5.27, 3.84, 559.1, 679.0, 64.7, 529.5, 9.16, 36.62, 373.8, 4.51, 4.84, 0.49, 29.63, 49.12, 813.3, 43.5, 0.04, 26.09, 134.9, 416.4, 2848.0, 17420.0, 55.6, 63.08, 0.82, 209.2, 187.8, 5.08, 6.64, 45.45, 25.61, 13.74], "marker": { "line": { "color": "rgb(180,180,180)", "width": 0.5 }, "opacity": 0.5 }, "text": ["Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas, The", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil", "British Virgin Islands", "Brunei", "Bulgaria", "Burkina Faso", "Burma", "Burundi", "Cabo Verde", "Cambodia", "Cameroon", "Canada", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Colombia", "Comoros", "Congo, Democratic Republic of the", "Congo, Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Curacao", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Islas Malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "French Polynesia", "Gabon", "Gambia, The", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guam", "Guatemala", "Guernsey", "Guinea-Bissau", "Guinea", "Guyana", "Haiti", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Isle of Man", "Israel", "Italy", "Jamaica", "Japan", "Jersey", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, North", "Korea, South", "Kosovo", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia, Federated States of", "Moldova", "Monaco", "Mongolia", "Montenegro", "Morocco", "Mozambique", "Namibia", "Nepal", "Netherlands", "New Caledonia", "New Zealand", "Nicaragua", "Nigeria", "Niger", "Niue", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal", "Puerto Rico", "Qatar", "Romania", "Russia", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Martin", "Saint Pierre and Miquelon", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore", "Sint Maarten", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Sudan", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Timor-Leste", "Togo", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Vietnam", "Virgin Islands", "West Bank", "Yemen", "Zambia", "Zimbabwe"], "colorscale": [ [0, "rgba(5, 10, 172, 0.3)"], [0.35, "rgba(40, 60, 190, 0.3)"], [0.5, "rgba(70, 100, 245, 0.3)"], [0.6, "rgba(90, 120, 245, 0.3)"], [0.7, "rgba(106, 137, 247, 0.3)"], [1, "rgba(220, 220, 220, 0.3)], "locations": ["AFG", "ALB", "DZA", "ASM", "AND", "AGO", "AIA", "ATG", "ARG", "ARM", "ABW", "AUS", "AUT", "AZE", "BHM", "BHR", "BGD", "BRB", "BLR", "BEL", "BLZ", "BEN", "BMU", "BTN", "BOL", "BIH", "BWA", "BRA", "VGB", "BRN", "BGR", "BFA", "MMR", "BDI", "CPV", "KHM", "CMR", "CAN", "CYM", "CAF", "TCD", "CHL", "CHN", "COL", "COM", "COD", "COG", "COK", "CRI", "CIV", "HRV", "CUB", "CUW", "CYP", "CZE", "DNK", "DJI", "DMA", "DOM", "ECU", "EGY", "SLV", "GNQ", "ERI", "EST", "ETH", "FLK", "FRO", "FJI", "FIN", "FRA", "PYF", "GAB", "GMB", "GEO", "DEU", "GHA", "GIB", "GRC", "GRL", "GRD", "GUM", "GTM", "GGY", "GNB", "GIN", "GUY", "HTI", "HND", "HKG", "HUN", "ISL", "IND", "IDN", "IRN", "IRQ", "IRL", "IMN", "ISR", "ITA", "JAM", "JPN", "JEY", "JOR", "KAZ", "KEN", "KIR", "KOR", "PRK", "KSV", "KWT", "KGZ", "LAO", "LVA", "LBN", "LSO", "LBR", "LBY", "LIE", "LTU", "LUX", "MAC", "MKD", "MDG", "MWI", "MYS", "MDV", "MLI", "MLT", "MHL", "MRT", "MUS", "MEX", "FSM", "MDA", "MCO", "MNG", "MNE", "MAR", "MOZ", "NAM", "NPL", "NLD", "NCL", "NZL", "NIC", "NGA", "NER", "NIU", "MNP", "NOR", "OMN", "PAK", "PLW", "PAN", "PNG", "PRY", "PER", "PHL", "POL", "PRT", "PRI", "QAT", "ROU", "RUS", "RWA", "KNA", "LCA", "MAF", "SPM", "VCT", "WSM", "SMR", "STP", "SAU", "SEN", "SRB", "SYC", "SLE", "SGP", "SXM", "SVK", "SVN", "SLB", "SOM", "ZAF", "SSD", "ESP", "LKA", "SDN", "SUR", "SWZ", "SWE", "CHE", "SYR", "TWN", "TJK", "TZA", "THA", "TLS", "TGO", "TON", "TTO", "TUN", "TUR", "TKM", "TUV", "UGA", "UKR", "ARE", "GBR", "USA", "URY", "UZB", "VUT", "VEN", "VNM", "VGB", "WBG", "YEM", "ZMB", "ZWE"], "reversescale": True, "autocolorscale": False } data = Data([trace1]) layout = { "geo": { "showframe": False, "projection": {"type": "Mercator"}, "showcoastlines": False }, "title": "", "xaxis": {"fixedrangemode": True}, "yaxis": {"fixedrangemode": True}, "margin": { "b": 0, "l": 0, "r": 0, "t": 0 }, "dragmode": "select" } fig = Figure(data=data, layout=layout) plot_url = py.plot(fig)