2017-03-13 1 views
8

Eigentlich bin ich neu in Python.Warum Python Liniendiagramm zeigt: Haben Sie kein Konto? plot.ly

Wenn ich versuche, den folgenden Code zu kompilieren:

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

Es zeigt die folgende Meldung an und geben Sie nicht eine Ausgabe. :

[email protected]:~/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. 
[email protected]:~/Desktop/pythonPrograms$  

Ich weiß nicht, was das ist und wie es zu beheben ist. Hilfe.

+0

Mögliche Duplikate von [Verwendung von Plotly ohne Online-Plotly-Konto] (http://Stackoverflow.com/questions/37745917/using-plotly-without-online-plotly-account) – ImportanceOfBeingErnest

+0

Ich habe Plotly nie online verwendet, so kann ich ' Ich helfe dir viel. Sind Sie sicher, dass Sie den Benutzernamen und api_key als Strings angegeben haben? Wenn dies Ihr echter api_key ist, bin ich mir nicht sicher, ob Sie ihn öffentlich mit anderen teilen sollten. – ImportanceOfBeingErnest

+0

Danke für diese Information. Würdest du mir bitte helfen, die Einstellung einzustellen – Textplus

Antwort

12

Ich bin auch ziemlich neu so plotly auf Python betroffen ist. Allerdings scheint mir das Problem, dass Sie plotly.plotly importieren.

Zitat aus der Dokumentation

Alle Methoden in plotly.plotly mit einem Plotly Wolke oder Plotly Unternehmen kommunizieren. get_figure lädt eine Figur aus plot.ly oder Plotly Enterprise herunter. Sie müssen Anmeldeinformationen bereitstellen Zahlen zum Download: https://plot.ly/python/getting-started/

Um das Beste aus meinem Verständnis, müssen Sie plotly importieren und dann Funktionen zu verwenden, wie in der zweiten Hälfte der Einführung zu dieser link Hoffnung erklärt, das hilft

Verwandte Themen