.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/basic.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_basic.py: mplcursors' core functionality ============================== ... is to add interactive data cursors to a figure. .. GENERATED FROM PYTHON SOURCE LINES 7-23 .. image-sg:: /examples/images/sphx_glr_basic_001.png :alt: Click somewhere on a line. Right-click to deselect. Annotations can be dragged. :srcset: /examples/images/sphx_glr_basic_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np import mplcursors data = np.outer(range(10), range(1, 5)) fig, ax = plt.subplots() lines = ax.plot(data) ax.set_title("Click somewhere on a line.\nRight-click to deselect.\n" "Annotations can be dragged.") fig.tight_layout() mplcursors.cursor(lines) plt.show() .. _sphx_glr_download_examples_basic.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: basic.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: basic.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_