import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.mplot3d.axes3d import Axes3D x = np.linspace(-5, 5, 10) y = np.array([-5,-4,-3,-2,1,4,7]) #y = np.linspace(-5, 5, 20)**3 ## 1. #x,y = np.meshgrid(x,y) ## 2. #x = x[:,np.newaxis] #y = y[np.newaxis] ## 3. x,y = np.mgrid[-5:5:10j, -5:5:20j] ## 4. #x,y = np.ogrid[-5:5:10j, -5:5:20j] z = np.sin(np.hypot(x,y)) print x.shape print y.shape print z.shape ax = plt.gca(projection='3d') ax.plot_wireframe(x, y, z) plt.show()