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

Skip to content

Commit 78198be

Browse files
committed
Avoid UnboundLocalError in drag_pan.
Axes.drag_pan should probably have been private but it's public and should therefore properly handle unexpected input.
1 parent 2bd942c commit 78198be

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4014,7 +4014,7 @@ def format_deltas(key, dx, dy):
40144014
p = self._pan_start
40154015
dx = x - p.x
40164016
dy = y - p.y
4017-
if dx == 0 and dy == 0:
4017+
if dx == dy == 0:
40184018
return
40194019
if button == 1:
40204020
dx, dy = format_deltas(key, dx, dy)
@@ -4035,6 +4035,8 @@ def format_deltas(key, dx, dy):
40354035
except OverflowError:
40364036
warnings.warn('Overflow while panning')
40374037
return
4038+
else:
4039+
return
40384040

40394041
valid = np.isfinite(result.transformed(p.trans))
40404042
points = result.get_points().astype(object)

0 commit comments

Comments
 (0)