python - 使用 plotly 时出现以下错误。AttributeError:模块'plotly.graph_objects'没有属性'figure'
问题描述
下面是我来自 Jupyter Notebook 的代码。
import chart_studio.plotly as py
import plotly.graph_objects as go
init_notebook_mode(connected=True)
data = dict(type='choropleth',
locations=['CA', 'NY', 'AZ'],
locationmode='USA-states',
colorscale='ylorbr',
text=['text1','text2','text3'],
z=[1.0, 2.0, 3.0],
colorbar={'title':'ColorbarTitle'})
#text- which hovers over all the locations
layout=dict(geo={'scope':'usa'})
choromap = go.figure(data=[data], layout=layout)
我已经完成了以下步骤: pip install chart-studio pip install ipywidgets
使用的绘图版本:4.7.1
和
还尝试了以下方法: from plotly import graph_objects as go
提前致谢..
解决方案
推荐阅读
- android - verifyIdToken() 的第一个参数必须是 Firebase ID 令牌字符串错误
- arrays - 我想从两个值数组中创建一个哈希数组
- amazon-web-services - 在 AWS ECS 上存储 GOOGLE_APPLICATION_CREDENTIALS json 的最佳方式
- snowflake-cloud-data-platform - 雪花中有关 util_db 的任何好的文档
- sap - Hybris 上的 ycommerce:testId 用途是什么(SAP CX Commerce)
- unix - 将 UNIX 命令的结果分配给变量
- angular - “在收到握手响应之前连接已关闭”尝试使用 websockets 将 Angular 与 Spring 连接时
- google-cloud-storage - 无法使用 dialogflow 播放 .mp3 文件
- android - 通过 Xcode 将 Flutter android 应用部署到 ios
- azure - 修改 Azure B2C 登录 V1 策略/用户流最小密码长度限制