为什么Python线图显示:没有帐户?plot.ly

Tex*_*lus 12 plot matplotlib python-2.7

其实我是python的新手.

当我尝试编译以下代码时:

import matplotlib.pyplot as plt

 import plotly.plotly as py
 # Learn about API authentication here: https://plot.ly/python/getting-started
 # Find your api_key here: https://plot.ly/settings/api

 x = [1,2,3,4]
 y = [3,4,8,6]

  plt.plot(x, 'o')
  plt.plot(y)
  fig = plt.gcf()

    plot_url = py.plot_mpl(fig, filename='mpl-line-scatter')
Run Code Online (Sandbox Code Playgroud)

它显示以下消息,不提供任何输出.:

 mks@mks-H81M-S:~/Desktop/pythonPrograms$ python plot.py 
 Aw, snap! We don't have an account for ''. Want to try again? You can        authenticate with your email address or username. Sign in is not case    sensitive.

 Don't have an account? plot.ly

 Questions? support@plot.ly
 xdg-open - opens a file or URL in the user's preferred application

  Synopsis

 xdg-open { file | URL }

 xdg-open { --help | --manual | --version }

 Use 'man xdg-open' or 'xdg-open --manual' for additional info.
 mks@mks-H81M-S:~/Desktop/pythonPrograms$    
Run Code Online (Sandbox Code Playgroud)

我不知道这是什么以及如何解决它.救命.

小智 13

就python问题而言,我也很新.但是,在我看来,问题在于您正在导入plotly.plotly.

引用文档

plotly.plotly中的所有方法都将与Plotly Cloud或Plotly Enterprise进行通信.get_figure从plot.ly或Plotly Enterprise下载一个数字.您需要提供下载数据的凭据:https://plot.ly/python/getting-started/

据我所知,你需要导入情节,然后使用这个链接的后半部分中解释的功能 希望这有助于