You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: axes3d.py's _on_move() converts the roll angle to radians, but then passes it to view_init() as if it were still in degrees #28256
In \lib\mpl_toolkits\mplot3d\axes3d.py, _on_move() deals with rotation of 3d axes using the mouse. In line 1522, the roll angle (in degrees) is converted to radians: roll = np.deg2rad(self.roll)
This roll in radians is used to calculate a new elevation and azimuth, like so:
However, view_init() expects its parameters to be in degrees, not radians. As a consequence, the roll now diminishes by a factor pi/180 with every mouse movement. Not intended.
Code for reproduction
# Run the surface3d.py example, addingax.roll=45# It shows the plot, in the intended funny orientation (roll=45)# Then move the mouse - you will see the orientation jump suddenly (to roll=0)
Actual outcome
The figure orientation has jumped to roll=0, after trying to rotate it only slightly by dragging the mouse:
Expected outcome
The figure is close to its original orientation (before dragging the mouse), at roll=45:
Additional information
Fix: add a line: roll = self.roll
right after updating elev and azim (i.e., after line 1526).
Activity
Fix roll angle units, issue matplotlib#28256
Add tests for roll, and for rotation using mouse
Add test for rotation using mouse
Merge pull request #28261 from MischaMegens2/roll-angle-units
Backport PR matplotlib#28261: Correct roll angle units, issue matplot…
Merge pull request #28294 from meeseeksmachine/auto-backport-of-pr-28…
Backport PR matplotlib#28261: Correct roll angle units, issue matplot…