ploting 3D surface in python (转载)# JobHunting - 待字闺中
l*9
1 楼
【 以下文字转载自 Statistics 讨论区 】
发信人: light009 (light009), 信区: Statistics
标 题: ploting 3D surface in python
发信站: BBS 未名空间站 (Mon Mar 31 16:14:16 2014, 美东)
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.
发信人: light009 (light009), 信区: Statistics
标 题: ploting 3D surface in python
发信站: BBS 未名空间站 (Mon Mar 31 16:14:16 2014, 美东)
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.