gpt4 book ai didi

python - 如何将 matplotlib 3d 图更改为侧 View ?

转载 作者:太空宇宙 更新时间:2023-11-03 10:50:08 29 4
gpt4 key购买 nike

如果有x、y、z坐标的数组。我不是要展示一个静态的 2d 图,它可以通过

plot(x, y)

我是说

import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D

fig = plt.figure()
ax = fig.gca(projection='3d')
ax.plot(x, y, z, label='parametric curve')

plt.show()

哪个 matplotlib 函数可以将 View 更改为侧 View ?这样我就可以为 matplotlib GUI 添加按钮,当用户单击该按钮时,3d 图将绘制为顶 View /左 View /...并且用户仍然可以使用鼠标以 3d 方式旋转图稍后,就像我们可以在 CAD 软件中做的一样。

谢谢

最佳答案

如果我理解你的问题,你正在寻找函数 Axes3D.view_init

view_init(elev=None, azim=None)

Set the elevation and azimuth of the axes.

This can be used to rotate the axes programatically.

‘elev’ stores the elevation angle in the z plane. ‘azim’ stores the azimuth angle in the x,y plane.

if elev or azim are None (default), then the initial value is used which was specified in the Axes3D constructor.

关于python - 如何将 matplotlib 3d 图更改为侧 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52203245/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com