Plotly Choropleth combined with ScatterGeo

Question:

Can anyone help me spot the error here?

fig = go.Figure()

fig.add_trace(
    go.Choroplethmapbox(
        geojson=counties,
        locations=df_se['FIPS'], z=df_se['use_values'],
        colorscale="Viridis", zmin=min(df_se['use_values']), zmax=max(df_se['use_values']),
        marker_opacity=0.5, marker_line_width=0
    ))

fig.add_trace(
    go.Scattergeo(
        lon = df_jake['lng'],
        lat = df_jake['lat'],
        text = df_jake['Name']+', '+df_jake['Link'],
        mode = 'markers'
    ))
fig.update_layout()
fig.show()

It just shows up blank. I can plot Chloropleth and ScatterGeo seperately however

Thanks!

Asked By: mustacheMcGee

||

Answers:

A bit of context: Choroplethmapbox makes choropleths on tile maps (example), whereas Scattergeo makes points on outline maps (example).

The scatter counterpart to Choroplethmapbox is Scattermapbox (example) and the choropleth counterpart to Scattergeo is Choropleth (example).

So the answer likely depends on what you are trying to do: if you’re trying to show a choropleth and scatter data on a tile map, you’ll want to switch from Scattergeo to Scattermapbox and if you want to show this data on an outline map, you’ll want to switch from Choroplethmapbox to Choropleth.

Answered By: nicolaskruchten