用于做等高线图你需要你的数据插值到规则网格http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data
一个简单的例子:
>>> xi = linspace(min(X), max(X))
>>> yi = linspace(min(Y), max(Y))
>>> zi = griddata(X, Y, Z, xi, yi)
>>> contour(xi, yi, zi)
为表面http://matplotlib.sourceforge.net/examples/mplot3d/surface3d_demo.html
>>> from mpl_toolkits.mplot3d import Axes3D
>>> fig = figure()
>>> ax = Axes3D(fig)
>>> xim, yim = meshgrid(xi, yi)
>>> ax.plot_surface(xim, yim, zi)
>>> show()
>>> help(meshgrid(x, y))
Return coordinate matrices from two coordinate vectors.
[...]
Examples
--------
>>> X, Y = np.meshgrid([1,2,3], [4,5,6,7])
>>> X
array([[1, 2, 3],
[1, 2, 3],
[1, 2, 3],
[1, 2, 3]])
>>> Y
array([[4, 4, 4],
[5, 5, 5],
[6, 6, 6],
[7, 7, 7]])
轮廓在3Dhttp://matplotlib.sourceforge.net/examples/mplot3d/contour3d_demo.html
>>> fig = figure()
>>> ax = Axes3D(fig)
>>> ax.contour(xi, yi, zi) # ax.contourf for filled contours
>>> show()
我发布了一个如何将数据放入二维数组以便能够使用matplotlib的表面图的示例:http://stackoverflow.com/a/30539444/3585557。另外,看看这些相关/类似/重复的帖子:http://stackoverflow.com/q/9170838/3585557,http://stackoverflow.com/q/12423601/3585557,http://stackoverflow.com/ q /三百五十八万五千五百五十七分之二千一百一十六万一千八百八十四,http://stackoverflow.com/q/26074542/3585557,http://stackoverflow.com/q/28389606/3585557,http://stackoverflow.com/q/29547687/3585557 – 2015-05-30 13:16:44