.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples\create_signal\2D_image_stack.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_auto_examples_create_signal_2D_image_stack.py: Creates a 4D image ================== This example creates a 4D dataset, i.e. 2 navigation dimension and 2 signal dimension and plots it. .. GENERATED FROM PYTHON SOURCE LINES 8-39 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/create_signal/images/sphx_glr_2D_image_stack_001.png :alt: Random 2D image stack Navigator :srcset: /auto_examples/create_signal/images/sphx_glr_2D_image_stack_001.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/create_signal/images/sphx_glr_2D_image_stack_002.png :alt: Random 2D image stack Signal :srcset: /auto_examples/create_signal/images/sphx_glr_2D_image_stack_002.png :class: sphx-glr-multi-img .. code-block:: Python import numpy as np import hyperspy.api as hs # Create a 2D image stack with random data im = hs.signals.Signal2D(np.random.random((16, 16, 32, 32))) # Define the axis properties im.axes_manager.signal_axes[0].name = '' im.axes_manager.signal_axes[0].units = '1/nm' im.axes_manager.signal_axes[0].scale = 0.1 im.axes_manager.signal_axes[0].offset = 0 im.axes_manager.signal_axes[1].name = '' im.axes_manager.signal_axes[1].units = '1/nm' im.axes_manager.signal_axes[1].scale = 0.1 im.axes_manager.signal_axes[1].offset = 0 im.axes_manager.navigation_axes[0].name = 'X' im.axes_manager.navigation_axes[0].units = 'nm' im.axes_manager.navigation_axes[0].scale = 0.3 im.axes_manager.navigation_axes[0].offset = 100 im.axes_manager.navigation_axes[1].name = 'Y' im.axes_manager.navigation_axes[1].units = 'nm' im.axes_manager.navigation_axes[1].scale = 0.3 im.axes_manager.navigation_axes[1].offset = 100 # Give a title im.metadata.General.title = 'Random 2D image stack' im.plot() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.604 seconds) .. _sphx_glr_download_auto_examples_create_signal_2D_image_stack.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 2D_image_stack.ipynb <2D_image_stack.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 2D_image_stack.py <2D_image_stack.py>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_