我正试图在Dash中用Choroplethmapbox构建一张地图,但我无法在其中绘制。
我用另一个工具测试geojson,在这个工具中,映射是正确的,但不是用Choroplethmapbox绘制的。
知道我做错了什么吗?
谢谢
GeoJson:
https://gist.github.com/Tlaloc-Es/5c82834e5e4a9019a91123cb11f598c0
Python代码:
import json
with open('mexico.geojson') as f:
counties = json.load(f)
fig = go.Figure(go.Choroplethmapbox(
geojson=counties,
locations=df['COV_'],
z=df['Enero'],
colorscale="Viridis", zmin=0, zmax=df['Enero'].max(),
marker_opacity=0.5, marker_line_width=0))
fig.update_layout(mapbox_style="carto-positron",
mapbox_zoom=3, mapbox_center = {"lat": 37.0902, "lon": -95.7129})
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})发布于 2020-07-18 10:27:48
我也有类似的问题。使用show方法,它可以很好地工作,有时也可以使用破折号(只使用回调)。这个问题的出现是因为dash的旧版本,它是通过默认的anaconda通道安装的(只有一个版本1.4.1)。安装后,通过conda-锻造通道更新版本(在我的例子1.13.4),它工作。
conda install -c conda-forge dash dash-core-components \
dash-html-components dash-renderer dash-table https://stackoverflow.com/questions/60815784
复制相似问题