在使用mplot3d.Axes3D绘制3D图形时,x、y、z轴的显示比例会被自动拉伸:
这样图上的圆柱都被压扁了很难看,我们想让x、y、z轴的显示比例就等于x、y、z轴范围之比,但如果使用画2D图时的plt.gca().set_aspect('equal', adjustable='box')
方法,会报如下错误:
NotImplementedError: Axes3D currently only supports the aspect argument 'auto'. You passed in 'equal'.
解决方法:
plt.gca().set_box_aspect((3, 5, 2)) # 当x、y、z轴范围之比为3:5:2时。
效果: