Skip to content

Commit 4ce3252

Browse files
Normalize the displayed angles for 3d plots when rotating with mouse
1 parent a851eff commit 4ce3252

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,9 +1214,12 @@ def format_coord(self, xd, yd):
12141214

12151215
if self.button_pressed in self._rotate_btn:
12161216
# ignore xd and yd and display angles instead
1217-
return (f"azimuth={self.azim:.0f}\N{DEGREE SIGN}, "
1218-
f"elevation={self.elev:.0f}\N{DEGREE SIGN}, "
1219-
f"roll={self.roll:.0f}\N{DEGREE SIGN}"
1217+
norm_azim = art3d._norm_angle(self.azim)
1218+
norm_elev = art3d._norm_angle(self.elev)
1219+
norm_roll = art3d._norm_angle(self.roll)
1220+
return (f"azimuth={norm_azim:.0f}\N{DEGREE SIGN}, "
1221+
f"elevation={norm_elev:.0f}\N{DEGREE SIGN}, "
1222+
f"roll={norm_roll:.0f}\N{DEGREE SIGN}"
12201223
).replace("-", "\N{MINUS SIGN}")
12211224

12221225
# nearest edge

0 commit comments

Comments
 (0)