gpt4 book ai didi

python-2.7 - 为什么 Python 线图显示 : Don't have an account? plot.ly

转载 作者:行者123 更新时间:2023-12-04 00:51:41 27 4
gpt4 key购买 nike

其实我是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。

从文档中引用

All methods in plotly.plotly will communicate with a Plotly Cloud or Plotly Enterprise. get_figure downloads a figure from plot.ly or Plotly Enterprise. You need to provide credentials to download figures: https://plot.ly/python/getting-started/



据我所知,您需要导入 plotly,然后使用此 link 介绍的后半部分中所述的函数。
希望这有帮助

关于python-2.7 - 为什么 Python 线图显示 : Don't have an account? plot.ly,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42771076/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com