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 b7e881f

Browse filesBrowse files
committed
Don't change Figure DPI if value unchanged
Check that the value of dpi is different before going through all the machinery to actually flush the change of value.
1 parent e702edd commit b7e881f
Copy full SHA for b7e881f

File tree

Expand file treeCollapse file tree

1 file changed

+6
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-5
lines changed

‎lib/matplotlib/figure.py

Copy file name to clipboardExpand all lines: lib/matplotlib/figure.py
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -442,11 +442,12 @@ def _set_dpi(self, dpi, forward=True):
442442
forward : bool
443443
Passed on to `~.Figure.set_size_inches`
444444
"""
445-
self._dpi = dpi
446-
self.dpi_scale_trans.clear().scale(dpi)
447-
w, h = self.get_size_inches()
448-
self.set_size_inches(w, h, forward=forward)
449-
self.callbacks.process('dpi_changed', self)
445+
if self._dpi != dpi:
446+
self._dpi = dpi
447+
self.dpi_scale_trans.clear().scale(dpi)
448+
w, h = self.get_size_inches()
449+
self.set_size_inches(w, h, forward=forward)
450+
self.callbacks.process('dpi_changed', self)
450451

451452
dpi = property(_get_dpi, _set_dpi, doc="The resolution in dots per inch.")
452453

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.