有谁知道如何使用plotly
里面jupyter notebook
使用python?情节内jupyter笔记本python
该文档组织得不是很好,至少不是从我的角度来看。
例如,我可以运行以下代码,但它会在可访问jupyter notebook
之外的HTML文件中生成图形。有没有办法让图形在笔记本内部呈现?
什么也不清楚(因为文档很差)是否需要一个凭据使用plotly
jupyter notebook
内的地块?凭证只需要在云上托管这些图表,而不需要其他任何东西?
以及我发现没有任何真实的文档cufflinks
。它所说的是它使plotly
与pandas
数据帧更容易使用。但对于不是开发人员的人来说,如果有详细的文档说明为什么它是必要的,它究竟做了什么使生活变得更加简单,那将是非常好的。
import plotly.plotly as py
from plotly.graph_objs import *
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 = Data([trace0, trace1])
plotly.offline.plot(data, filename = 'basic-line')
/Users/blahblah/anaconda/lib/python2.7/site-packages/plotly/offline/offline.py:433: UserWarning:
Your filename `basic-line` didn't end with .html. Adding .html to the end of your file.
'file:///Users/blahblach/Box Sync/NS/NBooks/basic-line.html'
In [ ]:
如果我更改代码的最后一行到:
py.iplot(data, filename = 'basic-line')
我得到的证书错误:
PlotlyLocalCredentialsError:
Couldn't find a 'username', 'api-key' pair for you on your local machine. To sign in temporarily (until you stop running Python), run:
>>> import plotly.plotly as py
>>> py.sign_in('username', 'api_key')
Even better, save your credentials permanently using the 'tools' module:
>>> import plotly.tools as tls
>>> tls.set_credentials_file(username='username', api_key='api-key')
For more help, see https://plot.ly/python.
UPDATE:
我试图执行的大熊猫示例如描述的here。
我得到所有df.iplot()
或Series.iplot()
命令的凭据错误。
有人可以解释为什么我尽管使用iplot()获取凭据错误。
关于cufflinks
也没有有用的文档。
plot.ly
文档是我见过的最差的文档之一。组织是一团糟,不是很友好的例子。
是否有可能像这样df.iplot(KIND = '散',执行什么......) 离线?没有可用的袖扣链接文件。我从https://plot.ly/ipython-notebooks/cufflinks/ – codingknob
尝试上面的袖扣示例时遇到凭证错误。是的,您可以通过“进口袖扣”离线,如cf ; cf.go_offline()'命令。然后,'df.iplot(kind ='scatter',filename ='cufflinks/cf-simple-line')'应该在笔记本中绘制该图。 – Psidom