.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/image.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_image.py: Cursors on images ================= ... display the underlying data value. .. GENERATED FROM PYTHON SOURCE LINES 7-23 .. image-sg:: /examples/images/sphx_glr_image_001.png :alt: Click anywhere on the image :srcset: /examples/images/sphx_glr_image_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np import mplcursors data = np.arange(100).reshape((10, 10)) fig, axes = plt.subplots(ncols=2) axes[0].imshow(data, interpolation="nearest", origin="lower") axes[1].imshow(data, interpolation="nearest", origin="upper", extent=[200, 300, 400, 500]) mplcursors.cursor() fig.suptitle("Click anywhere on the image") plt.show() .. _sphx_glr_download_examples_image.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: image.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: image.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_