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

Skip to content

Commit 3c5cbd8

Browse files
committed
Adding comment on scaling of coords.
1 parent 7db54c0 commit 3c5cbd8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/matplotlib/backends/backend_qt5agg.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ def paintEvent(self, event):
4141
# See documentation of QRect: bottom() and right() are off by 1, so use
4242
# left() + width() and top() + height().
4343
rect = event.rect()
44+
# scale rect dimensions using the screen dpi ratio to get
45+
# correct values for the Figure coordinates (rather than QT5's coords)
4446
width = rect.width() * self._dpi_ratio
4547
height = rect.height() * self._dpi_ratio
4648
left, top = self.mouseEventCoords(rect.topLeft())

0 commit comments

Comments
 (0)