Ich bin noch ziemlich neu bei Python und frage mich, ob die x.y-Anweisung bedeutet, dass y ein Submodul von x ist? Und wenn ja, nicht der Befehl:Was ist der Unterschied zwischen dem Import von Matplotlib und Matplotlib.pyplot?
import matplotlib.pyplot as plt
nur dieses bestimmte Submodul und nichts anderes importieren? Ich musste dies tun, um auf die hist
-Funktion zugreifen zu können. Wie wirkt sich das auf die Module aus, die normalerweise beim Aufruf von import matplotlib as plt
importiert werden? Kann ich alle Module in Matplotlib unter dem Plt-Namen zusammenbringen?
Ich bin mir bewusst, dass diese Frage zu what is the difference between importing python sub-modules from NumPy, matplotlib packages verwandt ist Aber die Antwort in dieser Frage sagt mir nicht, wenn nichts anderes in Matplotlib importiert wird und wie alle Matplotlib nur importieren, ohne sich Sorgen über Submodule weggelassen werden.
Was meinen Sie, Sie können nicht die 'plot' Funktion nicht mehr nutzen? – Plasma
@Plasma Nach dem Import von matplotlip.pyplot kann man plt.plot (x, y) nicht mehr benutzen (Modul nicht importiert ...?) Oder habe ich einfach etwas Dummes gemacht? – Moppentapper
Also, wenn Sie sagen "Import matplotlib.pyplot as plt" 'plt.plot()' wird nicht funktionieren? Oder sagst du 'import matplotlib.pyplot' und dann' plt.plot() '? – Plasma