2015-12-07 6 views
5

Ich versuche, Matplotlib zu verwenden. Ich habe es hier bei der Arbeit vorher benutzt und es lief gut. Ich verwende die IDLE-Umgebung und ich habe auf der Matplotlib-Website gelesen, dass der interaktive Modus in IDLE nicht funktioniert, aber das sollte in diesem Fall keine Rolle spielen. Auch scheint die Bibliothek zu importieren ganz gut:Matplotlib gibt nur Fehlermeldungen

>>> import numpy as np 
>>> import matplotlib as plt 
>>> x = np.arange(0,3 * np.pi, 0.1) 
>>> y = np.sin(x) 
>>> plt.plot(x,y) 
Traceback (most recent call last): 
    File "<pyshell#7>", line 1, in <module> 
    plt.plot(x,y) 
    AttributeError: 'module' object has no attribute 'plot' 

>>> plt.show() 
Traceback (most recent call last): 
    File "<pyshell#8>", line 1, in <module> 
    plt.show(x,y) 
    AttributeError: 'module' object has no attribute 'show' 

Antwort

14

ändern

import matplotlib as plt 

zu

import matplotlib.pyplot as plt 
+1

Beautiful! Vielen Dank! –

+1

Sie erhalten die Antwort Kredit sobald ich kann, die in einer Minute oder so sein sollte. –

Verwandte Themen