ax = fig.gca(projection=‘3d’)运行时导致如下报错:
TypeError: gca() got an unexpected keyword argument ‘projection’
解决方法:
- 替换为ax = fig.add_subplot(111, projection=‘3d’) ,该方法等效于gca() ,且在较新版本中更稳定,且避免了gca()的参数冲突问题
- 替换为ax = fig.add_axes(Axes3D(fig)),但是需要提前导入from mpl_toolkits.mplot3d import Axes3D