Ich habe eine Liste von Punkten:Verwendung von Kontur und contourf
pointList = [ [x1,y1,z1], [x2,y2,z2], ... [xn,yn,zn]]
und ich möchte ein Konturdiagramm dieser Menge von Punkten zeichnen.
Ich versuche:
import matplotlib.pyplot as plt
pointList = [ [x1,y1,z1], [x2,y2,z2], ... [xn,yn,zn]]
x = [el[0] for el in pointList]
y = [el[1] for el in pointList]
z = [el[2] for el in pointList]
plt.contourf(x,y,z)
plt.show()
aber ich habe diese Ausnahme:
TypeError: Input z must be a 2D array.
Diese seltsame ist, weil in der Dokumentation von matplotlib Ich finde:
Call signatures:
contour(Z)
make a contour plot of an array Z. The level values are chosen automatically.
contour(X,Y,Z)
X, Y specify the (x, y) coordinates of the surface
So I don‘ Ich verstehe, warum es fehlschlägt ...
Bilden Ihre Punkte tatsächlich eine Oberfläche? X und Y sind die eindeutigen x- und y-Werte, die für die Oberfläche verwendet werden. Es ist nicht für verstreute Daten verwendet werden – Suever
nicht sicher zu verstehen. Wie soll ich "tatsächlich" eine Oberfläche erstellen? – rudy
Mögliches Duplikat von [Kontur der Streuung erstellen] (http://stackoverflow.com/questions/18764814/make-contour-of-scatter) – Suever