<h3 dir="auto">Bug summary</h3>
<p dir="auto">Updating the plot stack via toolbar.update() and toolbar.push_current() breaks the behaviour of fig.set_tight_layout().<br>
"reset original view" makes the plot expand outside the viewable area.<br>
"reset" from "configure subplots" corrects it, but pressing "home" again re-breaks it.</p>
<h3 dir="auto">Code for reproduction</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import matplotlib.pyplot as plt
import matplotlib as mpl

mpl.use('TKAgg')

x1 = [1, 2, 3, 4, 5, 6]
y1 = [3, 4, 5, 6, 7, 8]

x2 = [2, 3, 4, 5, 6, 7]
y2 = [8, 7, 6, 5, 4, 3]

# do all the plot setup
fig, ax = plt.subplots(1, 1)
toolbar = fig.canvas.manager.toolbar
fig.set_tight_layout(True)
ax.margins(x=0)

# plot data - this really happens by the user choosing a dataset to plot
line, = ax.plot(x1, y1, marker=&quot;o&quot;, label=&quot;data&quot;)
ax.set_xlabel(&quot;X ordinate&quot;)

# zoom in - this really happens by user interaction with the zoom tool
ax.set_xlim(2.5, 5.5)
ax.set_ylim(3, 6)

# save the current zoom for restoring later
old_x_lim = ax.get_xlim()
old_y_lim = ax.get_ylim()

# replace data - this really happens by the user choosing new data to plot
line.set_data(x2, y2)

# let matplotlib calculate the optimal axes settings for the new data
ax.relim()
ax.autoscale()

# restore the zoom so the new data is plotted in the same view as the old
toolbar.update()  # Clear the axes stack
toolbar.push_current()  # save the current status as home
ax.set_xlim(old_x_lim)
ax.set_ylim(old_y_lim)

# show the plot - this really happens by the program calling things
plt.show()

#Now when I click the &quot;home&quot; button, the axes expand to put the axis titles and ticks off-screen, and
# if I keep clicking &quot;home&quot;, the move around. Clicking &quot;reset&quot; in the &quot;configure subplots&quot; menu puts everything right."><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-k">import</span> <span class="pl-s1">matplotlib</span> <span class="pl-k">as</span> <span class="pl-s1">mpl</span>

<span class="pl-s1">mpl</span>.<span class="pl-en">use</span>(<span class="pl-s">'TKAgg'</span>)

<span class="pl-s1">x1</span> <span class="pl-c1">=</span> [<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>, <span class="pl-c1">4</span>, <span class="pl-c1">5</span>, <span class="pl-c1">6</span>]
<span class="pl-s1">y1</span> <span class="pl-c1">=</span> [<span class="pl-c1">3</span>, <span class="pl-c1">4</span>, <span class="pl-c1">5</span>, <span class="pl-c1">6</span>, <span class="pl-c1">7</span>, <span class="pl-c1">8</span>]

<span class="pl-s1">x2</span> <span class="pl-c1">=</span> [<span class="pl-c1">2</span>, <span class="pl-c1">3</span>, <span class="pl-c1">4</span>, <span class="pl-c1">5</span>, <span class="pl-c1">6</span>, <span class="pl-c1">7</span>]
<span class="pl-s1">y2</span> <span class="pl-c1">=</span> [<span class="pl-c1">8</span>, <span class="pl-c1">7</span>, <span class="pl-c1">6</span>, <span class="pl-c1">5</span>, <span class="pl-c1">4</span>, <span class="pl-c1">3</span>]

<span class="pl-c"># do all the plot setup</span>
<span class="pl-s1">fig</span>, <span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplots</span>(<span class="pl-c1">1</span>, <span class="pl-c1">1</span>)
<span class="pl-s1">toolbar</span> <span class="pl-c1">=</span> <span class="pl-s1">fig</span>.<span class="pl-s1">canvas</span>.<span class="pl-s1">manager</span>.<span class="pl-s1">toolbar</span>
<span class="pl-s1">fig</span>.<span class="pl-en">set_tight_layout</span>(<span class="pl-c1">True</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">margins</span>(<span class="pl-s1">x</span><span class="pl-c1">=</span><span class="pl-c1">0</span>)

<span class="pl-c"># plot data - this really happens by the user choosing a dataset to plot</span>
<span class="pl-s1">line</span>, <span class="pl-c1">=</span> <span class="pl-s1">ax</span>.<span class="pl-en">plot</span>(<span class="pl-s1">x1</span>, <span class="pl-s1">y1</span>, <span class="pl-s1">marker</span><span class="pl-c1">=</span><span class="pl-s">"o"</span>, <span class="pl-s1">label</span><span class="pl-c1">=</span><span class="pl-s">"data"</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">set_xlabel</span>(<span class="pl-s">"X ordinate"</span>)

<span class="pl-c"># zoom in - this really happens by user interaction with the zoom tool</span>
<span class="pl-s1">ax</span>.<span class="pl-en">set_xlim</span>(<span class="pl-c1">2.5</span>, <span class="pl-c1">5.5</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">set_ylim</span>(<span class="pl-c1">3</span>, <span class="pl-c1">6</span>)

<span class="pl-c"># save the current zoom for restoring later</span>
<span class="pl-s1">old_x_lim</span> <span class="pl-c1">=</span> <span class="pl-s1">ax</span>.<span class="pl-en">get_xlim</span>()
<span class="pl-s1">old_y_lim</span> <span class="pl-c1">=</span> <span class="pl-s1">ax</span>.<span class="pl-en">get_ylim</span>()

<span class="pl-c"># replace data - this really happens by the user choosing new data to plot</span>
<span class="pl-s1">line</span>.<span class="pl-en">set_data</span>(<span class="pl-s1">x2</span>, <span class="pl-s1">y2</span>)

<span class="pl-c"># let matplotlib calculate the optimal axes settings for the new data</span>
<span class="pl-s1">ax</span>.<span class="pl-en">relim</span>()
<span class="pl-s1">ax</span>.<span class="pl-en">autoscale</span>()

<span class="pl-c"># restore the zoom so the new data is plotted in the same view as the old</span>
<span class="pl-s1">toolbar</span>.<span class="pl-en">update</span>()  <span class="pl-c"># Clear the axes stack</span>
<span class="pl-s1">toolbar</span>.<span class="pl-en">push_current</span>()  <span class="pl-c"># save the current status as home</span>
<span class="pl-s1">ax</span>.<span class="pl-en">set_xlim</span>(<span class="pl-s1">old_x_lim</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">set_ylim</span>(<span class="pl-s1">old_y_lim</span>)

<span class="pl-c"># show the plot - this really happens by the program calling things</span>
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()

<span class="pl-c">#Now when I click the "home" button, the axes expand to put the axis titles and ticks off-screen, and</span>
<span class="pl-c"># if I keep clicking "home", the move around. Clicking "reset" in the "configure subplots" menu puts everything right.</span></pre></div>
<h3 dir="auto">Actual outcome</h3>
<p dir="auto">After running the above code and pressing the "home" / "Reset original view" button once:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/14921460/146290775-5455f832-9f88-437a-ab1f-036e37898f44.png"><img src="https://user-images.githubusercontent.com/14921460/146290775-5455f832-9f88-437a-ab1f-036e37898f44.png" alt="mpl_bug1" style="max-width: 100%;"></a></p>
<p dir="auto">Furthermore, if there is an x-axis title, and the home button is clicked multiple times, the plot becomes smaller and smaller in the vertical direction, like:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/14921460/146290794-2207e20c-c134-47d3-8dce-5e9944699df2.png"><img src="https://user-images.githubusercontent.com/14921460/146290794-2207e20c-c134-47d3-8dce-5e9944699df2.png" alt="mpl_bug2" style="max-width: 100%;"></a></p>
<p dir="auto">and eventually I get a UserWarning:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="C:\Users\_______\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py:814: UserWarning: Tight layout not applied. The bottom and top margins cannot be made large enough to accommodate all axes decorations.
  func(*args)"><pre class="notranslate"><code class="notranslate">C:\Users\_______\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py:814: UserWarning: Tight layout not applied. The bottom and top margins cannot be made large enough to accommodate all axes decorations.
  func(*args)
</code></pre></div>
<p dir="auto">and tight_layout is removed. After this, all functionality appears to be normal.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/14921460/146290811-7f7d8cb1-1d87-499d-97e3-95e1d826d15e.png"><img src="https://user-images.githubusercontent.com/14921460/146290811-7f7d8cb1-1d87-499d-97e3-95e1d826d15e.png" alt="mpl_bug3" style="max-width: 100%;"></a></p>
<h3 dir="auto">Expected outcome</h3>
<p dir="auto">The expected outcome, after pressing the home button, looks like</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/14921460/146290851-6109cb67-d29e-449b-af8b-234aa70bf680.png"><img src="https://user-images.githubusercontent.com/14921460/146290851-6109cb67-d29e-449b-af8b-234aa70bf680.png" alt="mpl_expected1" style="max-width: 100%;"></a></p>
<p dir="auto">And continuing to press the home button should not further alter the view.</p>
<h3 dir="auto">Additional information</h3>
<p dir="auto">This only happens when tight layout is set to True.<br>
The vertical shrinking only happens when there is an X axis label.<br>
There is no horizontal shrinking when a y axis label is set.<br>
The same behaviour was observed in 3.4.3<br>
Behaviour persists in TKAgg, QtAgg, Qt5Agg, wxAgg</p>
<h3 dir="auto">Operating system</h3>
<p dir="auto">Windows 10</p>
<h3 dir="auto">Matplotlib Version</h3>
<p dir="auto">3.5.1</p>
<h3 dir="auto">Matplotlib Backend</h3>
<p dir="auto">TKAgg</p>
<h3 dir="auto">Python version</h3>
<p dir="auto">3.9.4</p>
<h3 dir="auto">Jupyter version</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Installation</h3>
<p dir="auto">pip</p>
<p dir="auto">This might not be a bug but I doubt that it is an intended behavior.  <code class="notranslate">figure.clf() </code> don't change the subplot parameters to any default values so it is not enough to do  <code class="notranslate">figure.clf() </code> when testing to plot with or without for example  <code class="notranslate">tight_layout </code>. This is easy to fix by adding for example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="keys = ('left', 'right', 'bottom','top','wspace','hspace')
subplots_default = {key : rcParams['figure.subplot.' + key] for key in keys}
self.subplotpars.update(**subplots_default)"><pre class="notranslate"><code class="notranslate">keys = ('left', 'right', 'bottom','top','wspace','hspace')
subplots_default = {key : rcParams['figure.subplot.' + key] for key in keys}
self.subplotpars.update(**subplots_default)
</code></pre></div>
<p dir="auto">to figure.clf()</p>
<p dir="auto">When I looked into this I also found that the docstrings for  <code class="notranslate">subplots_adjust </code> and  <code class="notranslate">SubplotParams </code> are kind of confusing and not really correct. The default is, except in  <code class="notranslate">SuplotParams.__ini__ </code> (that most people probably newer use directly), not the rc parameters that it seems but the actual attributes in the  <code class="notranslate">SuplotParams </code> object. So it is not trivial to start all over with the default rc variables after a change in the subplotparameters by for example tight_layout.</p>
<ul dir="auto">
<li>Would it be good to add an option in subplot_adjust to adjust to the default parameters?</li>
<li>Would it be good to add a get function for the subplotparameters?</li>
</ul>
<p dir="auto">The documentation should probably be changed anyway. Are there any method to avoid writing almost the same things several times?  <code class="notranslate">figure.subplots_adjust </code> and <code class="notranslate">plt.subplots_adjust</code> should have more or less the exact same docstring and the  <code class="notranslate">SuplotParams </code> should also have a similar one.</p>