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



实际上我是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')

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

 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$    

我不知道这是什么以及如何修复它。帮助。

,就python的情节而言,我也很新。但是,在我看来,问题是您正在绘制绘图。

引用文档

plotly中的所有方法都将与情节云或 Plotly Enterprise。get_figure从plot.ly下载一个数字或 Plotly Enterprise。您需要提供凭证才能下载 图:https://plot.ly/python/getting-started/

为了最好的理解,您需要导入剧情,然后使用此链接的后半部分中所述的功能希望这有帮助

检查官方文档。您要做的就是使用Plotly Cloud在线绘制图形。这就是它要求进行身份验证的原因。

i建议您登录并尝试设置API键等,如果您脱机绘图会更好。

最终图被保存为您本地系统中的HTML文件,如果需要,可以在以后使用。这是您这样做的方式:

import plotly as py
fig = dict( data=data, layout=layout )
py.offline.plot( fig, filename='d3-cloropleth-map' )

最新更新