Notiz
Klicken Sie hier , um den vollständigen Beispielcode herunterzuladen
Das mplot3d-Toolkit #
Generieren von 3D-Diagrammen mit dem mplot3d-Toolkit.
Dieses Tutorial zeigt verschiedene 3D-Plots. Klicken Sie auf die Abbildungen, um jedes vollständige Galeriebeispiel mit dem Code anzuzeigen, der die Abbildungen generiert.
3D-Achsen (der Klasse Axes3D
) werden erstellt, indem das projection="3d"
Schlüsselwortargument an übergeben wird Figure.add_subplot
:
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(projection='3d')
Mehrere 3D-Subplots können auf derselben Figur hinzugefügt werden, wie bei 2D-Subplots.

Geändert in Version 1.0.0: Vor Matplotlib 1.0.0 konnte nur eine Single Axes3D
pro Figur erstellt werden; es musste direkt als instanziiert werden .ax = Axes3D(fig)
Geändert in Version 3.2.0: Vor Matplotlib 3.2.0 war es notwendig, das
mpl_toolkits.mplot3d
Modul explizit zu importieren, um die 3D-Projektion in
Figure.add_subplot
.
Weitere Informationen zum mplot3d-Toolkit finden Sie in den häufig gestellten Fragen zu mplot3d.
Liniendiagramme #
Siehe Axes3D.plot
API-Dokumentation.

Streudiagramme #
Siehe Axes3D.scatter
API-Dokumentation.

Drahtgitterdiagramme #
Siehe Axes3D.plot_wireframe
API-Dokumentation.

Oberflächenplots #
Siehe Axes3D.plot_surface
API-Dokumentation.

Tri-Surface-Plots #
Siehe Axes3D.plot_trisurf
API-Dokumentation.

Konturdiagramme #
Siehe Axes3D.contour
API-Dokumentation.

Gefüllte Konturdiagramme #
Siehe Axes3D.contourf
API-Dokumentation.

Neu in Version 1.1.0: Die im zweiten contourf3d-Beispiel gezeigte Funktion wurde als Ergebnis eines Bugfixes für Version 1.1.0 aktiviert.
Polygondiagramme #
Siehe Axes3D.add_collection3d
API-Dokumentation.

Balkendiagramme #
Siehe Axes3D.bar
API-Dokumentation.

Köcher #
Siehe Axes3D.quiver
API-Dokumentation.

2D-Plots in 3D #

Text #
Siehe Axes3D.text
API-Dokumentation.
