<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">When I save a figure my canvas is smaller as before. As I need to extract images from an interactive pyplot I cannot align them anymore afterwards.</p>
<p dir="auto"><strong>Code for reproduction</strong></p>

<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import matplotlib.pyplot as plt
f = plt.Figure()
plt.plot([1,2,3])
f.savefig('test.png')"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>
<span class="pl-s1">f</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-v">Figure</span>()
<span class="pl-s1">plt</span>.<span class="pl-en">plot</span>([<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span>])
<span class="pl-s1">f</span>.<span class="pl-en">savefig</span>(<span class="pl-s">'test.png'</span>)</pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>

<p dir="auto">Figure gets saved, figure shrinks. Subsequent figure is then a tiny bit smaller</p>
<p dir="auto"><strong>Expected outcome</strong></p>
<p dir="auto">The figure gets saved, the canvas or figure size stays untouched.</p>
<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating System: Win10 64</li>
<li>Matplotlib Version: 2.0.2</li>
<li>Python Version: 3.5.2</li>
<li>Spyder 3 using Qt5</li>
</ul>
<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">The <code class="notranslate">print_figure</code> function in the <code class="notranslate">FigureCanvasBase</code> class records the current figure's dpi, sets it to the requested dpi for the saved figure, and then resets it to the original. Setting the dpi invokes a property function, <code class="notranslate">_set_dpi</code> that calls the figure's <code class="notranslate">set_size_inches</code> method, which then triggers a resize of the figure manager.</p>
<p dir="auto">This resize is not evident when I use the standard Pyplot commands within a Qt console, presumably because the plot size doesn't change. However, I have embedded the Matplotlib figure in a PyQt GUI where I don't have the toolbar in the same widget, and it causes a noticeable size change for a fraction of a second before the second dpi reset restores the old size.</p>
<p dir="auto"><strong>Possible solution</strong></p>
<p dir="auto">I would like to suggest that the <code class="notranslate">FigureCanvasBase</code> <code class="notranslate">print_figure</code> function should not invoke the dpi property, but set and then reset the figure's hidden variable, <code class="notranslate">_dpi</code>, which will not trigger the redundant canvas resize. I can submit a pull request, but I wanted to check if there would be side effects.</p>
<p dir="auto"><strong>Matplotlib version</strong></p>
<ul dir="auto">
<li>Matplotlib Version: 2.0.2</li>
<li>Operating System: Mac OS 10.12.5</li>
<li>Python Version: 2.7.11</li>
<li>PyQt 4.8.7</li>
</ul>