
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples/keyboard_shortcuts.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_examples_keyboard_shortcuts.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_examples_keyboard_shortcuts.py:


Keyboard shortcuts
==================

By default, mplcursors uses "t" to toggle interactivity and "d" to hide/show
annotation boxes.  These shortcuts can be customized.

.. GENERATED FROM PYTHON SOURCE LINES 8-20



.. image-sg:: /examples/images/sphx_glr_keyboard_shortcuts_001.png
   :alt: Press "e" to enable/disable the datacursor Press "h" to hide/show any annotation boxes
   :srcset: /examples/images/sphx_glr_keyboard_shortcuts_001.png
   :class: sphx-glr-single-img





.. code-block:: Python


    import matplotlib.pyplot as plt
    import mplcursors

    fig, ax = plt.subplots()
    ax.plot(range(10), "o-")
    ax.set_title('Press "e" to enable/disable the datacursor\n'
                 'Press "h" to hide/show any annotation boxes')

    mplcursors.cursor(bindings={"toggle_visible": "h", "toggle_enabled": "e"})

    plt.show()


.. _sphx_glr_download_examples_keyboard_shortcuts.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: keyboard_shortcuts.ipynb <keyboard_shortcuts.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: keyboard_shortcuts.py <keyboard_shortcuts.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: keyboard_shortcuts.zip <keyboard_shortcuts.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
