.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/create_signal/line_spectrum.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_line_spectrum.py: Creates a line spectrum ======================= This example creates a line spectrum and plots it. .. GENERATED FROM PYTHON SOURCE LINES 7-29 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/create_signal/images/sphx_glr_line_spectrum_001.png :alt: Random line spectrum Navigator :srcset: /auto_examples/create_signal/images/sphx_glr_line_spectrum_001.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/create_signal/images/sphx_glr_line_spectrum_002.png :alt: Random line spectrum Signal :srcset: /auto_examples/create_signal/images/sphx_glr_line_spectrum_002.png :class: sphx-glr-multi-img .. code-block:: Python import numpy as np import hyperspy.api as hs # Create a line spectrum with random data s = hs.signals.Signal1D(np.random.random((100, 1024))) # Define the axis properties s.axes_manager.signal_axes[0].name = 'Energy' s.axes_manager.signal_axes[0].units = 'eV' s.axes_manager.signal_axes[0].scale = 0.3 s.axes_manager.signal_axes[0].offset = 100 s.axes_manager.navigation_axes[0].name = 'time' s.axes_manager.navigation_axes[0].units = 'fs' s.axes_manager.navigation_axes[0].scale = 0.3 s.axes_manager.navigation_axes[0].offset = 100 # Give a title s.metadata.General.title = 'Random line spectrum' # Plot it s.plot() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.803 seconds) .. _sphx_glr_download_auto_examples_create_signal_line_spectrum.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: line_spectrum.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: line_spectrum.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_