.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "classes/base_classes/data/plot_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_classes_base_classes_data_plot_image.py: ===== Image ===== Image on a regular two-dimensional grid. The x-axis and y-axis define a regular 2D grid. The grid is equally spaced in this example but this is not necessarily the case. .. code:: @NX_class = "NXroot" @default = "scan1" scan1: @NX_class = "NXentry" @default = "data" data: @NX_class = "NXdata" @axes = ["y", "x"] @signal = "z" x: NX_FLOAT64[16] y: NX_FLOAT64[30] z: NX_FLOAT64[30,16] Explanation: 1. ``@axes`` has two values which corresponds to the signal rank of two. 2. ``z`` is the default signal to be plotted versus ``x`` and ``y``. 3. ``z`` has 30 rows and 16 columns. 4. ``y`` spans the first dimension of ``z`` and ``x`` the second. .. GENERATED FROM PYTHON SOURCE LINES 36-56 .. image-sg:: /classes/base_classes/data/images/sphx_glr_plot_image_001.png :alt: plot image :srcset: /classes/base_classes/data/images/sphx_glr_plot_image_001.png :class: sphx-glr-single-img .. code-block:: Python # Data import numpy as np x = np.linspace(-3, 3, 16) y = np.linspace(-3, 3, 30) xx, yy = np.meshgrid(x, y) z = (1 - xx / 2 + xx**5 + yy**3) * np.exp(-(xx**2) - yy**2) # Plot import matplotlib.pyplot as plt # noqa E402 plt.style.use("_mpl-gallery-nogrid") fig, ax = plt.subplots() ax.imshow(z, extent=[x[0], x[-1], y[0], y[-1]], origin="lower") plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.033 seconds) .. _sphx_glr_download_classes_base_classes_data_plot_image.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_image.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_image.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_image.zip `