I have a list of points:
pointList = [ [x1,y1,z1], [x2,y2,z2], ... [xn,yn,zn]]
and I want to draw a contour plot of this set of points.
I try:
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()
but I have this exception:
TypeError: Input z must be a 2D array.
This is strange because in the documentation of matplotlib I find:
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't understand why it fails ...