Plotly Choropleth地图未显示在Google Colab中
我一直在尝试通过Internet建议的每个解决方案,但它们似乎都不适合我。当我尝试在Colab中绘制绘图时,我要么获得一个空白页,要么是我的唱片地图的传奇/配色栏。有人可以帮我吗? 这是我尝试绘制的非常基本的代码。
import plotly.express as px
fig = px.choropleth(gdf,
locations="id",
geojson=geojson,
color="Total - Visible minority",
scope="north america",
projection="conic conformal"
)
fig.show()
I have been trying every single solution that has been suggested over the Internet, but none of them seems to work for me. I get either a blank page or just the legend/colorbar for my choropleth map when I try to plot with Plotly in Colab. Can someone help me out with it?
Here is a very basic code that I try to plot.
import plotly.express as px
fig = px.choropleth(gdf,
locations="id",
geojson=geojson,
color="Total - Visible minority",
scope="north america",
projection="conic conformal"
)
fig.show()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我遇到了几个错误,并带有您可能已经看到的建议:
plotly Notebook Mode with Plotly Notebook模式Google合作制作
特别是这三个可能的修复程序:
或通过设置全局默认值:
最后,不幸的是,通过创建此功能,必须在每个单元格中设置浏览器默认值:
然后运行
conduce> configure_plotly_browser_state()代码>在带有
图show()
的单元格中,我知道不是一个美丽的解决方案,但希望它们为您服务。
I've encountered a couple of errors, with suggestions you may have seen:
Plotly notebook mode with google colaboratory
In particular these three possible fixes:
Or by setting global default:
Finally, and unfortunately the possibility of having to set browser defaults in each cell by creating this function:
And then running
configure_plotly_browser_state()
in the cell withfig.show()
Not a beautiful solution I know, but hopefully they work for you.