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

Skip to content

Commit a20f6e1

Browse files
committed
taking into account possible None values of x and y
1 parent d15c344 commit a20f6e1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,10 +1342,10 @@ class LocationEvent(Event):
13421342
13431343
Attributes
13441344
----------
1345-
x : scalar
1345+
x : int
13461346
x position - pixels from left of canvas
13471347
1348-
y : scalar
1348+
y : int
13491349
y position - pixels from bottom of canvas
13501350
13511351
inaxes : bool
@@ -1365,8 +1365,8 @@ def __init__(self, name, canvas, x, y, guiEvent=None):
13651365
*x*, *y* in figure coords, 0,0 = bottom, left
13661366
"""
13671367
Event.__init__(self, name, canvas, guiEvent=guiEvent)
1368-
self.x = int(x) # x position - pixels from left of canvas
1369-
self.y = int(y) # y position - pixels from right of canvas
1368+
self.x = int(x) if x is not None else 0 # x position - pixels from left of canvas
1369+
self.y = int(y) if y is not None else 0 # y position - pixels from right of canvas
13701370
self.inaxes = None # the Axes instance if mouse us over axes
13711371
self.xdata = None # x coord of mouse in data coords
13721372
self.ydata = None # y coord of mouse in data coords

0 commit comments

Comments
 (0)