.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/data_visualization/compose_figure.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_data_visualization_compose_figure.py: Composing Figure ================ This example shows how to compose a figure using :func:`~.api.plot.plot_images` and :func:`~.api.plot.plot_spectra` .. GENERATED FROM PYTHON SOURCE LINES 10-14 .. code-block:: Python import hyperspy.api as hs import matplotlib.pyplot as plt import numpy as np .. GENERATED FROM PYTHON SOURCE LINES 15-16 Create the 1D and 2D signals .. GENERATED FROM PYTHON SOURCE LINES 18-24 .. code-block:: Python 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 .. GENERATED FROM PYTHON SOURCE LINES 25-26 Create an array of :external+matplotlib:class:`matplotlib.axis.Axis` using :external+matplotlib:func:`matplotlib.pyplot.subplots` .. GENERATED FROM PYTHON SOURCE LINES 28-31 .. code-block:: Python 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") .. image-sg:: /auto_examples/data_visualization/images/sphx_glr_compose_figure_001.png :alt: compose figure :srcset: /auto_examples/data_visualization/images/sphx_glr_compose_figure_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none array([, ], dtype=object) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.467 seconds) .. _sphx_glr_download_auto_examples_data_visualization_compose_figure.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: compose_figure.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: compose_figure.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: compose_figure.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_