[英]Python mapbox showing blank map in Jupyter
I have a problem about not showing show Mapbox in Jupyter.我有一个关于在 Jupyter 中不显示显示 Mapbox 的问题。
I check if it works via https://api.mapbox.com/?access_token=myaccesstoken
it always returns {"api":"mapbox"}
我检查它是否通过
https://api.mapbox.com/?access_token=myaccesstoken
它总是返回{"api":"mapbox"}
I updated token many times but nothing changed.我多次更新令牌,但没有任何改变。 How can I fix it?
我该如何解决?
Here is my code snippet.这是我的代码片段。
import plotly.graph_objects as go
import plotly.io as pio
import plotly.express as px
access_token = 'my-mapbox-token'
px.set_mapbox_access_token(access_token)
fig = px.density_mapbox(...)
fig.update_layout(margin={"r":0,"t":30,"l":0,"b":0})
fig.show()
Can you try to pass the token with your first update_layout() call, in which you should set your map style:您可以尝试在第一次 update_layout() 调用中传递令牌,您应该在其中设置地图样式:
fig.update_layout(mapbox_style="dark", mapbox_accesstoken=token)
See this example for reference:请参阅此示例以供参考:
https://plotly.com/python/mapbox-layers/ https://plotly.com/python/mapbox-layers/
-> Go to example "Dark tiles from Mapbox service.." -> 转到示例“来自 Mapbox 服务的深色瓷砖..”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.