设置 matplotlib 3d 绘图纵横比 [英] set matplotlib 3d plot aspect ratio

查看:49
本文介绍了设置 matplotlib 3d 绘图纵横比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

设置纵横比适用于二维图:

Setting the aspect ratio works for 2d plots:

ax = plt.axes()
ax.plot([0,1],[0,10])
ax.set_aspect('equal','box')

但不适用于 3d:

ax = plt.axes(projection='3d')
ax.plot([0,1],[0,1],[0,10])
ax.set_aspect('equal','box')

对于 3d 案例是否有不同的语法,或者没有实现?

Is there a different syntax for the 3d case, or it's not implemented?

推荐答案

我的理解基本上是这还没有实现(参见 GitHub 中的这个错误).我也希望它尽快实施.请参阅此链接以获取可能的解决方案(我还没有自己测试过).

My understanding is basically that this isn't implemented yet (see this bug in GitHub). I'm also hoping that it is implemented soon. See This link for a possible solution (I haven't tested it myself).

这篇关于设置 matplotlib 3d 绘图纵横比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆