Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
838 views
in Technique[技术] by (71.8m points)

matplotlib - Why Python line plot shows : Don't have an account? plot.ly

Actually I am new in python.

When I am trying to compile the following code:

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')

It shows the following message and don't give any output. :

 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? [email protected]
 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$    

I don't know what is this and how to fix it. Help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I'm also pretty new as far as plotly on python is concerned. However, it seems to me that the problem is the fact that you are importing plotly.plotly.

To quote from the documentation

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/

To the best of my understanding, you need to import plotly and then use functions as explained in the latter half of the introduction on this link Hope this helps


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...