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

Skip to content

Commit 13237c2

Browse files
committed
Added clarity on bounding box construction.
1 parent 3c5cbd8 commit 13237c2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/matplotlib/backends/backend_qt5agg.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ def paintEvent(self, event):
4848
left, top = self.mouseEventCoords(rect.topLeft())
4949
# shift the "top" by the height of the image to get the
5050
# correct corner for our coordinate system
51-
top -= height
52-
bbox = Bbox([[left, top], [left + width, top + height]])
53-
# create a buffer using this bounding box
51+
bottom = top - height
52+
# same with the right side of the image
53+
right = left + width
54+
# create a buffer using the image bounding box
55+
bbox = Bbox([[left, bottom], [right, top]])
5456
reg = self.copy_from_bbox(bbox)
5557
buf = cbook._unmultiplied_rgba8888_to_premultiplied_argb32(
5658
memoryview(reg))

0 commit comments

Comments
 (0)