<divid="unreleased-message"> You are reading an old version of the documentation (v3.0.3). For the latest version see <ahref="/stable/">https://matplotlib.org/stable/</a></div>
<spanid="navigation-toolbar"></span><h1>Interactive navigation<aclass="headerlink" href="#interactive-navigation" title="Permalink to this headline">¶</a></h1>
<dd>These are akin to a web browser's home, forward and back controls.
<codeclass="docutils literal notranslate"><spanclass="pre">Forward</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">Back</span></code> are used to navigate back and forth between
previously defined views. They have no meaning unless you have already
navigated somewhere else using the pan and zoom buttons. This is analogous
to trying to click <codeclass="docutils literal notranslate"><spanclass="pre">Back</span></code> on your web browser before visiting a
new page or <codeclass="docutils literal notranslate"><spanclass="pre">Forward</span></code> before you have gone back to a page --
nothing happens. <codeclass="docutils literal notranslate"><spanclass="pre">Home</span></code> always takes you to the
first, default view of your data. Again, all of these buttons should
feel very familiar to any user of a web browser.</dd>
<dd>Click this button to launch a file save dialog. You can save
files with the following extensions: <codeclass="docutils literal notranslate"><spanclass="pre">png</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">ps</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">eps</span></code>,
<codeclass="docutils literal notranslate"><spanclass="pre">svg</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">pdf</span></code>.</dd>
<spanid="key-event-handling"></span><h2>Navigation Keyboard Shortcuts<aclass="headerlink" href="#navigation-keyboard-shortcuts" title="Permalink to this headline">¶</a></h2>
<p>The following table holds all the default keys, which can be overwritten by use of your matplotlibrc (#keymap.*).</p>
<tableborder="1" class="docutils">
<colgroup>
<colwidth="41%" />
<colwidth="59%" />
</colgroup>
<theadvalign="bottom">
<trclass="row-odd"><thclass="head">Command</th>
<thclass="head">Keyboard Shortcut(s)</th>
</tr>
</thead>
<tbodyvalign="top">
<trclass="row-even"><td>Home/Reset</td>
<td><strong>h</strong> or <strong>r</strong> or <strong>home</strong></td>
</tr>
<trclass="row-odd"><td>Back</td>
<td><strong>c</strong> or <strong>left arrow</strong> or <strong>backspace</strong></td>
</tr>
<trclass="row-even"><td>Forward</td>
<td><strong>v</strong> or <strong>right arrow</strong></td>
<trclass="row-odd"><td>Constrain pan/zoom to x axis</td>
<td>hold <strong>x</strong> when panning/zooming with mouse</td>
</tr>
<trclass="row-even"><td>Constrain pan/zoom to y axis</td>
<td>hold <strong>y</strong> when panning/zooming with mouse</td>
</tr>
<trclass="row-odd"><td>Preserve aspect ratio</td>
<td>hold <strong>CONTROL</strong> when panning/zooming with mouse</td>
</tr>
<trclass="row-even"><td>Toggle major grids</td>
<td><strong>g</strong> when mouse is over an axes</td>
</tr>
<trclass="row-odd"><td>Toggle minor grids</td>
<td><strong>G</strong> when mouse is over an axes</td>
</tr>
<trclass="row-even"><td>Toggle x axis scale (log/linear)</td>
<td><strong>L</strong> or <strong>k</strong> when mouse is over an axes</td>
</tr>
<trclass="row-odd"><td>Toggle y axis scale (log/linear)</td>
<td><strong>l</strong> when mouse is over an axes</td>
</tr>
</tbody>
</table>
<p>If you are using <aclass="reference internal" href="../api/_as_gen/matplotlib.pyplot.html#module-matplotlib.pyplot" title="matplotlib.pyplot"><codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">matplotlib.pyplot</span></code></a> the toolbar will be created
automatically for every figure. If you are writing your own user
interface code, you can add the toolbar as a widget. The exact syntax
depends on your UI, but we have examples for every supported UI in the
<codeclass="docutils literal notranslate"><spanclass="pre">matplotlib/examples/user_interfaces</span></code> directory. Here is some
<spanclass="n">win</span><spanclass="o">.</span><spanclass="n">set_title</span><spanclass="p">(</span><spanclass="s2">"Embedding in GTK"</span><spanclass="p">)</span>
<spanclass="n">canvas</span><spanclass="o">=</span><spanclass="n">FigureCanvas</span><spanclass="p">(</span><spanclass="n">fig</span><spanclass="p">)</span><spanclass="c1"># a Gtk.DrawingArea</span>