We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e702edd commit b7e881fCopy full SHA for b7e881f
lib/matplotlib/figure.py
@@ -442,11 +442,12 @@ def _set_dpi(self, dpi, forward=True):
442
forward : bool
443
Passed on to `~.Figure.set_size_inches`
444
"""
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)
+ if self._dpi != dpi:
+ self._dpi = dpi
+ self.dpi_scale_trans.clear().scale(dpi)
+ w, h = self.get_size_inches()
+ self.set_size_inches(w, h, forward=forward)
450
+ self.callbacks.process('dpi_changed', self)
451
452
dpi = property(_get_dpi, _set_dpi, doc="The resolution in dots per inch.")
453
0 commit comments