Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f9b67a4

Browse filesBrowse files
authored
Merge pull request #10568 from AlexHarn/ratio_fix
Prevent ZeroDivisionError when devicePixelRatio() returns 0
2 parents 6874c42 + d12110f commit f9b67a4
Copy full SHA for f9b67a4

File tree

Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed

‎lib/matplotlib/backends/backend_qt5.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_qt5.py
+2-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.