python plotly:PlotlyError

python plotly:PlotlyError,python,plotly,Python,Plotly,我正在学校里有计划地学习python 当我尝试这个例子时: import plotly.plotly as py fig = py.get_figure('https://plot.ly/~jackp/8715', raw=True) iplot(fig) 答案给了我这个错误: --------------------------------------------------------------------------- PlotlyError

我正在学校里有计划地学习python 当我尝试这个例子时:

import plotly.plotly as py 
fig = py.get_figure('https://plot.ly/~jackp/8715', raw=True)
iplot(fig)
答案给了我这个错误:

---------------------------------------------------------------------------
PlotlyError                               Traceback (most recent call last)
<ipython-input-13-71d04f672671> in <module>()
      1 import plotly.plotly as py
      2 
----> 3 fig = py.get_figure('https://plot.ly/~jackp/8715', raw=True)
      4 iplot(fig)

D:\ProgramData\Anaconda2\lib\site-packages\plotly\plotly\plotly.pyc in get_figure(file_owner_or_url, file_id, raw)
    407                 "'{1}'."
    408                 "\nRun help on this function for more information."
--> 409                 "".format(url, plotly_rest_url))
    410         head = plotly_rest_url + "/~"
    411         file_owner = url.replace(head, "").split('/')[0]

PlotlyError: Because you didn't supply a 'file_id' in the call, we're assuming you're trying to snag a figure from a url. You supplied the url, 'https://plot.ly/~jackp/8715', we expected it to start with 'https://plotly.your-company.com'.
Run help on this function for more information.
---------------------------------------------------------------------------
PlotlyError回溯(最近一次调用上次)
在()
1导入plotly.plotly作为py
2.
---->3图=py.get\u图('https://plot.ly/~jackp/8715',原始=真实)
4 iplot(图)
D:\ProgramData\Anaconda2\lib\site packages\plotly\plotly\plotly.pyc在get\u图中(文件\u所有者\u或\u url、文件\u id、原始)
407                 "'{1}'."
408“\n有关详细信息,请运行此函数的帮助。”
-->409''格式(url,plotly\u rest\u url))
410 head=plotly\u rest\u url+“/~”
411文件_owner=url.replace(头“”).split(“/”)[0]
PlotlyError:因为您在调用中没有提供“文件id”,我们假设您试图从url中获取一个数字。您提供了url,'https://plot.ly/~jackp/8715',我们希望它从'https://plotly.your-company.com'.
有关详细信息,请运行此函数的帮助。
我不知道错误在哪里,我想可能是url被破坏了。

以下是获取凭据文件的方法。在学习教程时,通读这些示例总是有帮助的,正确设置您的环境非常重要

  • 去创建一个帐户
  • 去拿一个API密钥
  • 在尝试获取地物之前,请在代码中键入以下内容(必须导入plotly以及plotly.plotly):
  • plotly.tools.set_-credentials_文件(username='username-from-step-1',api_-key='key-you-copied-from-step-2')

    此线路将允许您访问


    编辑:
    iplot(图)
    仅适用于某些设置,如果您遇到新错误。试着用
    py.plot(fig)

    替换该行,如示例上方所述-
    您需要提供下载图形的凭据。谢谢。我尝试了您的建议,但它也不起作用。如何修改它