简体   繁体   English

如何使用 Python 禁用 plotly 等值线地图框 plot 的放大?

[英]How to disable zoom in plotly choropleth mapbox plot with Python?

Here is my code:这是我的代码:

fig = px.choropleth_mapbox(district_df[['District','Confirmed','Deaths','id','province']], geojson = geo_df, locations='id', color='Confirmed',
                           color_continuous_scale="Viridis",
                           mapbox_style="carto-positron",
                           zoom=5.9, hover_name = 'District',hover_data = {'District':False, 'Confirmed':True,'Deaths':True,'province':False,'id':False},
                           opacity=0.5, center = {"lat": 28.3949, "lon": 84.1240})

I would like to disable the zooming option.我想禁用缩放选项。 Is there a way?有办法吗?

Yes, update_layout will do if you set dragmode=False.是的,如果您设置 dragmode=False,update_layout 就可以了。

https://community.plotly.com/t/map-graph-disable-scrollzoom-drag/9664 https://community.plotly.com/t/map-graph-disable-scrollzoom-drag/9664

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM