小编Ant*_*rez的帖子

“Mapbox 地图”的自动缩放

在plotly网站Map Configuration and Styling in Python中描述了如何自动缩放“地理地图”:

import plotly.express as px

fig = px.line_geo(lat=[0,15,20,35], lon=[5,10,25,30])            # Creates a "Geo map" figure
fig.update_geos(fitbounds="locations")                           # Automatic Zooming !!!!
fig.show()
Run Code Online (Sandbox Code Playgroud)

这有效,而且如果我尝试在“Mapbox 地图”上进行相同的操作,它不会应用自动缩放:

fig = px.scatter_mapbox(filtered_df, lat="latitude", lon="longitude", color="ID")  # Creates a "Mapbox map" figure
fig.update_layout(mapbox_style="open-street-map")
fig.update_geos(fitbounds="locations")                                             # Automatic Zooming not working!!!
Run Code Online (Sandbox Code Playgroud)

在 Python 的 Mapbox 地图图层中没有如何执行此操作的信息。

python mapbox plotly-python

11
推荐指数
2
解决办法
1万
查看次数

标签 统计

mapbox ×1

plotly-python ×1

python ×1