Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Dcc Graph won't place a go.Choropleth map, instead shows base map with colour bar

$
0
0

@doogyb wrote:

Hi,

I’m running into some difficulty with Choropleth maps…

I’ve placed this component in my dash app:

dcc.Graph(
         figure=dict(
             data=[
                 go.Choropleth(
                     geojson=county_geojson,
                     locationmode="geojson-id",
                     locations=counties.index,  # Spatial coordinates
                     z=counties.astype(int),  # Data to be color-coded
                     featureidkey="properties.name",
                 )
             ]
         )
     )

Which returns the following:

However, if I use the exact same code as above and simply call fig.show(), the correct choropleth maps appears:

import plotly.graph_objects as go

fig = go.Figure(
    data=go.Choropleth(
        geojson=county_geojson,
        locations=counties.index,  # Spatial coordinates
        z=counties.astype(int),  # Data to be color-coded
        featureidkey="properties.name",
    )
)
fig.update_geos(fitbounds="locations", visible=False)
fig.show()

Any help with this would be greatly appreciated!

Thanks,

Sam

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6271

Latest Images

Trending Articles



Latest Images