Matplotlib 3D plot - 2D format for input data?
问题 I am plotting a function of two parameters with matplotlib. I copied an example in matplotlib tutorial and transformed with my own input data: vectors X and Y (equally spaces numbers in -3:3) and Z=peaks(X,Y) with peaks a function that I defined befohand. What is wrong? def peaks(x,y): xsq=x**2 ysq=y**2 xsq_one=(x+1)**2 ysq_one=(y+1)**2 m1=3*(1-x)**2 m2=10*(x/5-x**3-y**5) m3=1/3 return m1*numpy.exp(-xsq-ysq_one)-m2*numpy.exp(-xsq-ysq)-m3*numpy.exp(-xsq_one-ysq) from mpl_toolkits.mplot3d