我想作一个简单的三维表面的情节与matplotlib但情节并不在年底显现。我只能得到一个空的3D轴。 这是我做的
I am trying to make a simple 3D surface plot with matplotlib but the plot does not show at the end. I only get an empty 3D axes. Here is what I did
from mpl_toolkits.mplot3d import Axes3D
x= np.arange(1, 100, 1)
y= np.arange(1, 100, 1)
z= np.arange(1, 100, 1)
fig= figure()
ax= fig.add_subplot(111, projection ='3d')
ax.plot_surface(x, y, z, rstride= 5, cstride= 5)
show()
所以,我得到这个
So I get this
有什么建议?
您没有绘制表面: X
,是
和以Z
必须是二维数组。请看下面的例子: http://matplotlib.org/examples/mplot3d/surface3d_demo.html。
You are not plotting a surface: x
, y
and z
needs to be 2D arrays. Look at this example: http://matplotlib.org/examples/mplot3d/surface3d_demo.html.