Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3847471

Browse files
committed
Simplify PolarAxes.can_pan.
In the modified code, dt0 is always == -dt1 so they have the same absolute value and the else clause is always triggered. This is used in polar pan mode, which, when using the left mouse button, allows one to move the radial tick labels around... (the right mouse button allows zooming in and out (changing rmax, which seems less obscure.)
1 parent 1a89250 commit 3847471

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

lib/matplotlib/projections/polar.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,13 +1398,7 @@ def drag_pan(self, button, key, x, y):
13981398
t, r = p.trans_inverse.transform_point((x, y))
13991399

14001400
# Deal with theta
1401-
dt0 = t - startt
1402-
dt1 = startt - t
1403-
if abs(dt1) < abs(dt0):
1404-
dt = abs(dt1) * np.sign(dt0) * -1.0
1405-
else:
1406-
dt = dt0 * -1.0
1407-
dt = (dt / np.pi) * 180.0
1401+
dt = np.rad2deg(startt - t)
14081402
self.set_rlabel_position(p.r_label_angle - dt)
14091403

14101404
trans, vert1, horiz1 = self.get_yaxis_text1_transform(0.0)

0 commit comments

Comments
 (0)