如何禁用matplotlib中3D图的垂直摄像机旋转?

问题描述 投票:0回答:3
i有3D图表面。我想禁用此图的垂直摄像头旋转。

python matplotlib 3d mouseevent mplot3d
3个回答
2
投票

from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = fig.add_subplot(111, projection='3d') X, Y, Z = axes3d.get_test_data(0.1) # disable mouse ax.disable_mouse_rotation() ax.plot_wireframe(X, Y, Z, rstride=5, cstride=5) # set start rotation ax.view_init(30, 120) plt.show()


我的解决方案:

2
投票
def disable_vert_rotation(event): azim = ax.azim ax.view_init(elev=0, azim=azim) fig.canvas.mpl_connect('motion_notify_event', disable_vert_rotation)

这可能是相关的:

0
投票
https://matplotlib.org/stable/api/toolkits/mplot3d/view_angles.html#rotation-with-mouse


i发现,使用azel

鼠旋转样式将限制该情节直立。如果那是您禁用垂直摄像机旋转的意思。


最新问题
© www.soinside.com 2019 - 2025. All rights reserved.