l******9 发帖数: 579 | 1 I would like to make a 3D surfaceplot in python 3.2 by matplotlib on win 7.
My code:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d.axes3d import Axes3D
from mpl_toolkits.mplot3d import axes3d
def plotFunc():
x = np.linspace(0.00001,70 ,10) // x is a list of numbers
y = np.linspace(0.01, 70,10)
result = np.linspace(0.01, 70,10)
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.plot_surface(x, y, result, rstride=5, cstride=5, alpha=0.3)
ax.set_xlabel('shape')
ax.set_xlim(0, 70)
ax.set_ylabel('scale')
ax.set_ylim(0, 70)
ax.set_zlabel('result')
ax.set_zlim(0, 70)
plt.show()
But, I got nothing in the output except teh three axises.
Any help would be appreciated. | S******y 发帖数: 1123 | 2 try this -
x,y = np.meshgrid(x,y)
------------------------------------------------------------------------
http://plus.google.com/+statsGuyMITBBS/about
------------------------------------------------------------------------
【在 l******9 的大作中提到】![](/moin_static193/solenoid/img/up.png) : I would like to make a 3D surfaceplot in python 3.2 by matplotlib on win 7. : My code: : import numpy as np : import matplotlib.pyplot as plt : from matplotlib import cm : from mpl_toolkits.mplot3d.axes3d import Axes3D : from mpl_toolkits.mplot3d import axes3d : def plotFunc(): : x = np.linspace(0.00001,70 ,10) // x is a list of numbers : y = np.linspace(0.01, 70,10)
|
|