2016-02-27 81 views
0

当我尝试绘图中pycharm 3D对象我得到这个错误:与Axes3d 3D绘图不执行

TypeError: 'module' object is not callable 

代码结构:

# visualizing data with pyplot 
#usings 
import numpy as np 
import matplotlib.pyplot as plt 
import urllib 
from mpl_toolkits.mplot3d import axes3d 
#main code 
fig=plt.figure() 
ax=axes3d(fig) 
t=np.linspace(0,5*np.pi,501) 
ax.plot(np.cos(t),np.sin(t),t) 
plt.show() 

回答

0

见工作代码示例here

我交换了ax=axes3d(fig)的线ax=axes3d(fig),它运行良好。

import numpy as np 
import matplotlib.pyplot as plt 

from mpl_toolkits.mplot3d import axes3d 
#main code 
fig=plt.figure() 
ax = fig.gca(projection='3d') 
t=np.linspace(0,5*np.pi,501) 
ax.plot(np.cos(t),np.sin(t),t) 
plt.show() 
+0

谢谢,问题解决了。 – scapa

+0

好吧,然后请upvote答案:) – roadrunner66