<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">I'm looking for resetting the zoom and pan history of interactve browsing. Using <code class="notranslate">toolbar.update()</code> breaks the interactive history, it's not possible to go back to the previous axis state.</p>
<p dir="auto"><strong>Code for reproduction</strong></p>
<p dir="auto">Run this code in python a console:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from matplotlib import pyplot as plt
f = plt.figure()
plt.plot([1, 2, 5])
plt.show(block=False)
f.canvas.toolbar._views._elements  # One element
f.canvas.toolbar._positions._elements  # One element
f.canvas.toolbar.update()
f.canvas.toolbar._views._elements  # Empty !
f.canvas.toolbar._positions._elements  # Empty !
# Zoom once
# Try to go back using the home button or back arrow"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">matplotlib</span> <span class="pl-k">import</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-en">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">5</span>])
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>(<span class="pl-s1">block</span><span class="pl-c1">=</span><span class="pl-c1">False</span>)
<span class="pl-s1">f</span>.<span class="pl-s1">canvas</span>.<span class="pl-s1">toolbar</span>.<span class="pl-s1">_views</span>.<span class="pl-s1">_elements</span>  <span class="pl-c"># One element</span>
<span class="pl-s1">f</span>.<span class="pl-s1">canvas</span>.<span class="pl-s1">toolbar</span>.<span class="pl-s1">_positions</span>.<span class="pl-s1">_elements</span>  <span class="pl-c"># One element</span>
<span class="pl-s1">f</span>.<span class="pl-s1">canvas</span>.<span class="pl-s1">toolbar</span>.<span class="pl-en">update</span>()
<span class="pl-s1">f</span>.<span class="pl-s1">canvas</span>.<span class="pl-s1">toolbar</span>.<span class="pl-s1">_views</span>.<span class="pl-s1">_elements</span>  <span class="pl-c"># Empty !</span>
<span class="pl-s1">f</span>.<span class="pl-s1">canvas</span>.<span class="pl-s1">toolbar</span>.<span class="pl-s1">_positions</span>.<span class="pl-s1">_elements</span>  <span class="pl-c"># Empty !</span>
<span class="pl-c"># Zoom once</span>
<span class="pl-c"># Try to go back using the home button or back arrow</span></pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>
<p dir="auto">The view doesn't change when pressing home button or back arrow</p>
<p dir="auto"><strong>Expected outcome</strong></p>
<p dir="auto">I expect to be able to got back to the state the plot was in when <code class="notranslate">f.canvas.toolbar.update()</code> was called, but since the history is completely empty, there is no state to go back to. I think the current state should be added right after clearing the history. Is it possible to do it manually in the meantime ?</p>
<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: Arch Linux</li>
<li>Matplotlib version: 2.1.0-1</li>
<li>Matplotlib backend (<code class="notranslate">print(matplotlib.get_backend())</code>): Qt5Agg</li>
<li>Python version: 3.6.3</li>
<li>Jupyter version (if applicable):</li>
<li>Other libraries:</li>
</ul>
<p dir="auto">There are two entries in <a href="http://matplotlib.org/devdocs/gallery.html#lines_bars_and_markers" rel="nofollow">http://matplotlib.org/devdocs/gallery.html#lines_bars_and_markers</a> for marker_reference.py that point to the same page -- likely because that example generates <em>two</em> plots.</p>
<p dir="auto">A few possibilities:</p>
<ul dir="auto">
<li>generate a single plot (probably the simplest and good enough).</li>
<li>split the example into two files.</li>
<li>somehow have the second link point to an HTML anchor corresponding to the second plot.</li>
</ul>