✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Example that combines a Scatteplot on a Choropleth

Hi
I’m new to Plotly and am looking for a way to superimpose a Scattermapbox onto a US Choropleth.
By themselves, both of these chart types are on the plotly site.
Is there an example (or method) to superimpose one on the other?

In my case, the Choropleth shows revenue per county by color. The scattermapbox shows lat/lon/info of each sale.

Thanks in advance :slight_smile:

Which US Choropleth example are you referring to? Thanks.

Hi Etienne
The Choropleth example is here: https://plot.ly/python/choropleth-maps/

For the next revision, Id like to show income by by US county based (somewhat) from: https://plot.ly/python/county-level-choropleth/. I’d be using a US counties shape file for this… maybe a little manipulation in Geopandas which I’m also learning

For both, I’m plottling sale locations by lat/lon on top of the choropleth : https://plot.ly/python/scattermapbox/

I’m pretty new at this. Any nudge in the right direction is appreciated. Building the groupby in python pandas is no problem :slight_smile: I’m just trying to figure out how to plot it.

Is the solution format like this? Where the first is a Choropleth and the second is a Scattermapbox?
data = Data([
Scattermapbox(
lat=site_lat,
lon=site_lon,
mode=‘markers’,
marker=Marker(
size=17,
color=colors,
opacity=0.7
),
text=locations_name,
hoverinfo=‘text’,
showlegend=False
),
Scattermapbox(
lat=site_lat,
lon=site_lon,
mode=‘markers’,
marker=Marker(
size=8,
color=‘rgb(242, 177, 172)’,
opacity=0.7
),
hoverinfo=‘skip’,
showlegend=False
)
])

Thanks in advance
Graham

Did you ever figure this out? I would like to do the same.

1 Like