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

Skip to content

Commit 066629e

Browse files
authored
Merge pull request matplotlib#10626 from matplotlib/auto-backport-of-pr-10568
Backport PR matplotlib#10568 on branch v2.2.x
2 parents d10ec65 + 6ccb91d commit 066629e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ def _update_figure_dpi(self):
269269
def _dpi_ratio(self):
270270
# Not available on Qt4 or some older Qt5.
271271
try:
272-
return self.devicePixelRatio()
272+
# self.devicePixelRatio() returns 0 in rare cases
273+
return self.devicePixelRatio() or 1
273274
except AttributeError:
274275
return 1
275276

0 commit comments

Comments
 (0)