Composing Figure#

This example shows how to compose a figure using plot_images() and plot_spectra()

import hyperspy.api as hs
import matplotlib.pyplot as plt
import numpy as np

Create the 1D and 2D signals

s2D_0 = hs.signals.Signal2D(np.arange(100).reshape(10, 10))
s2D_1 = -s2D_0

s1D_0 = hs.signals.Signal1D(np.arange(100))
s1D_1 = -s1D_0

Create an array of matplotlib.axis.Axis using matplotlib.pyplot.subplots()

fig, axs = plt.subplots(ncols=2, nrows=2)
hs.plot.plot_images([s2D_0, s2D_1], ax=axs[:, 0], axes_decor="off")
hs.plot.plot_spectra([s1D_0, s1D_1], ax=axs[:, 1], style="mosaic")
compose figure
/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/site-packages/rsciio/utils/rgb_tools.py:62: VisibleDeprecationWarning: The module `rsciio.utils.rgb_tools` has been renamed to `rsciio.utils.rgb` and it will be removed in version 1.0.
  warnings.warn(

array([<Axes: xlabel='<undefined> (<undefined>)', ylabel='Intensity'>,
       <Axes: xlabel='<undefined> (<undefined>)', ylabel='Intensity'>],
      dtype=object)

Total running time of the script: (0 minutes 0.456 seconds)

Gallery generated by Sphinx-Gallery