Your charts. Your style. Your way.
Create, style and publish interactive web-ready charts
No coding required
最近买了一本《基于plotly的动态可视化绘图》,发现书还是跟不上官方文档啊!
在书上介绍还有官网介绍的记录plotly
的Username和API_key,这里貌似在当前目录很难生成一个.plotly/.credentials
,路过的有知道的可以在评论区留言让我明白一下!
发现在官网找到了这一句:Online features (plotly.plotly) moved to chart-studio package
给上官网最近新近版本的介绍:Version 4 Migration Guide in Python
- Replace
plotly.api
withchart_studio.api
- Replace
plotly.dashboard_objs
withchart_studio.dashboard_objs
- Replace
plotly.grid_objs
withchart_studio.grid_objs
- Replace
plotly.presentation_objs
withchart_studio.presentation_objs
- Replace
plotly.widgets
withchart_studio.widgets
貌似在官网中找到了一些眉目:online features
已经迁移到chart_studio
库中,貌似看起来还不错的样子!
import chart_studio
chart_studio.tools.set_credentials_file(
username='', # 这儿就不放我自己的账号和api了
api_key=''
)
import chart_studio.plotly as py
from plotly.graph_objects import Scatter
trace0 = Scatter(
x = [1, 2, 3, 4],
y = [10, 15, 13, 17]
)
trace1 = Scatter(
x = [1, 2, 3, 4],
y = [16, 5, 11, 9]
)
data = ([trace0, trace1])
py.plot(data, filename='first_start')
自己从iris
数据中玩一下
import plotly as py
import plotly