✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Combine Choropleth and Scatter_geo

Hi,

I have the following problem:

import plotly.express as px
import plotly.graph_objs as go

fig_map = px.choropleth(locations=[“Austria”, “Bulgaria”, “Croatia”, “Republic of Cyprus”, “Czech Republic”, “Denmark”, “Estonia”, “Finland”, “France”, “Germany”, “Greece”, “Hungary”, “Ireland”, “Italy”, “Latvia”, “Lithuania”, “Luxembourg”, “Malta”, “Netherlands”, “Poland”, “Portugal”, “Romania”, “Slovakia”, “Slovenia”, “Spain”, “Sweden”, “China”, “Japan”, “Cyprus”, “South Korea”, “Taiwan”, “Indonesia”, “Thailand”, “Vietnam”, “Singapur”, “Philippines”, “Myanmar”, “North Korea”, “Malaysia”, “Cambodia”, “Laos”, “Bangladesh”, “Bhutan”, “Nepal”, “Mongolia”, “Kazakhstan”, “Kyrgyztan”, “Tajikistan”, “Uzbekistan”, “Turkmenistan”, “Papua New Guinea”, “Argentinia”, “Bolivia”, “Brazil”, “Chile”, “Colombia”, “Costa Rica”, “Cuba”, “Dominican Republic”, “Ecuador”, “El Salvador”, “Guatemala”, “Haiti”, “Honduras”, “Mexico”, “Nicaragua”, “Panama”, “Paraguay”, “Peru”, “Uruguay”, “Venezuela”, “Guyana”, “Suriname”, “India”, “Bahrain”, “Iran”, “Turkey”, “Iraq”, “Israel”, “Jordan”, “Kuwait”, “Lebanon”, “Oman”, “Palestine”, “Qatar”, “Saudi Arabia”, “Syria”, “The United Arab Emirates”, “Yemen”, “Pakistan”, “Afghanistan”, “Azerbaijan”, “Georgia”, “Algeria”, “Angola”, “Benin”, “Botswana”, “Rwanda”, “Burundi”, “Ivory Coast”, “Burkina Faso”, “Burundi”, “Cabo Verde”, “Cameroon”, “Democratic Republic of Congo”, “Central African Republic”, “Chad”, “Comoros”, “Congo”, “Djibouti”, “Egypt”, “Equatorial Guinea”, “Eritrea”, “Eswatini”, “Ethiopia”, “Gabon”, “Gambia”, “Ghana”, “Guinea”, “Guinea-Bissau”, “Kenya”, “Lesotho”, “Liberia”, “Libya”, “Madagascar”, “Malawi”, “Mali”, “Mauritania”, “Mauritius”, “Morocco”, “Mozambique”, “Namibia”, “Niger”, “Nigeria”, “Rwanda”, “Senegal”, “Seychelles”, “Sierra Leone”, “Somalia”, “South Africa”, “South Sudan”, “Sudan”, “Tanzania”, “Togo”, “Tunisia”, “Uganda”, “Zambia”, “Zimbabwe”, “USA”, “Canada”, “Greenland”, “Russia”, “United Kingdom”, “Norway”, “Albania”, “Andorra”, “Armenia”, “Azerbaijan”, “Belarus”, “Bosnia and Herzegovina”, “Georgia”, “Iceland”, “Kosovo”, “Liechtenstein”, “Moldova”, “Monaco”, “Montenegro”, “North Macedonia”, “San Marino”, “Serbia”, “Switzerland”, “Ukraine”, “Vatican City”, “Belgium”, “Australia”],
color = [“EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “EU27”, “CN”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WA”, “WL”, “WL”, “WL”, “WL”, “WL”, “WL”, “WL”, “WL”, “WL”, “WL”, “WL”, “WL”, “WL”, “WL”, “WL”, “WL”, “WL”, “WL”, “WL”, “WL”, “WL”, “WL”, “IN”, “WM”, “WM”, “WM”, “WM”, “WM”, “WM”,“WM”,“WM”, “WM”, “WM”, “WM”, “WM”, “WM”, “WM”,“WM”, “WM”, “WM”, “WM”, “WM”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “WF”, “NA”, “NA”, “NA”, “RU”, “GB”, “NO”, “WE”, “WE”, “WE”, “WE”, “WE”, “WE”, “WE”, “WE”, “WE”, “WE”, “WE”, “WE”, “WE”, “WE”, “WE”, “WE”, “WE”, “WE”, “WE”, “BE”, “AU”],
locationmode = ‘country names’)

df1 = df

df_1995 = df1.iloc[:,0:2]
df_1995[“Countries”] = [“Germany”, “China”, “Kazakhstan”, “Brazil”, “India”, “Iraq”, “Chad”, “USA”, “Russia”, “Great Britain”, “Norway”, “Ukraine”, “Belgium”, “Australia”]
df_1995[“iso_alpha”] = [“DEU”, “CHN”, “KAZ”, “BRA”, “IND”, “IRQ”, “TCD”, “USA”, “RUS”, “GBR”, “NOR”, “UKR”, “BEL”, “AUS”]

fig_bubble = px.scatter_geo(df_1995, locations = “iso_alpha”,
size = “1995”,)

fig_bubble.show()
fig_map.show()

With this ugly code, I cluster countries with Choropleth and color them and with scatter_geo I create a bubble map. Now, I didn’t find a way to combine them, so I have the bubbles on my colored map.

Is there a way to combine those two maps?

Thank you very much!!!