python - Plotly 地图未显示在 VS Code 中的 Jupyter Notebook 中
问题描述
堆栈!我正在尝试在 Python 中使用 plotly 绘制图形。具体来说:情节:地图,气泡图,Choropleth.. Python:3.9.6 情节:4.01 Jupyter Notebook:7.26 环境管理器:miniconda3 IDE:Ms. Visual Studio Code
我试图运行这样的代码:
import plotly
import plotly.offline as pyo
pyo.init_notebook_mode()
import plotly.graph_objs as go
import plotly.express as ex
df = ex.data.gapminder().query("year==2007")
fig = ex.choropleth(df, locations="iso_alpha",
color="lifeExp", # lifeExp is a column of gapminder
hover_name="country", # column to add to hover information
color_continuous_scale=ex.colors.sequential.Plasma)
这不是我的项目代码,只是我在 Plotly 网站 ( https://plotly.com/python/choropleth-maps/ ) 上找到的 Plotly Map 的示例代码,但它没有显示任何内容。
PS:我尝试从 conda 安装 plotly Jupyterlab 依赖项,我也尝试使用离线 plotly 但仍然没有出现。(只有绘图画布和图例,缺少地图)。虽然,当我尝试制作条形图时,它可以工作。高手帮帮我!!!!!!
解决方案
推荐阅读
- python - 在 Python 中用整数清除百分比列(小数 + 整数)
- java - Powershell 不会将 .java 文件编译成 .class 文件
- cloud - 用于安排将数据库和文件/文件夹自动备份到云的基于 Web 的软件
- android - 我们可以在 iOS 设备上无线运行 Flutter 应用吗?
- powershell - 查找和替换 ”。” 特点
- excel - Excel VBA 使用哪种随机数生成器?
- css - 属于联系表 7 多步骤一部分的按钮在移动版本上无法正确显示
- php - 如何在 php 上打开具有变量(数组)名称的文件?
- python - 如何制作我的脚本,只接收网页的 URL,解析其 POST 请求的响应?
- regex - 如何通过 .htaccess 将包含 2 个正斜杠的任何 URL 重定向到主页?