+ + +
+
+ +
+
+ +
+ +
+ + + + +
+ +
+ + +
+
+ + + + + +
+ + +
+

Specifying Matplotlib Axis#

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

Signal2D#

+

Create two Signal2D

+
s = hs.signals.Signal2D(np.arange(100).reshape(10, 10))
+s2 = -s
+
+
+

Create a list of matplotlib.axis.Axis using +matplotlib.pyplot.subplots() and +specify the second matplotlib axis of the list to plot_images()

+
fig, axs = plt.subplots(ncols=3, nrows=1)
+hs.plot.plot_images(s, ax=axs[1], axes_decor="off")
+
+
+()
[<Axes: >]
+
+
+

The same can be done for a list of signals and axis

+
fig, axs = plt.subplots(ncols=3, nrows=1)
+hs.plot.plot_images([s, s2], ax=axs[1:3], axes_decor="off")
+
+
+specifying ax
[<Axes: >, <Axes: >]
+
+
+
+
+

Signal1D#

+

The same can be for Signal1D

+

Create two Signal2D

+
s = hs.signals.Signal1D(np.arange(100))
+s2 = -s
+
+
+

Create an array of matplotlib.axis.Axis using +matplotlib.pyplot.subplots() and +specify the two las matplotlib axis of the second line to plot_spectra()

+
fig, axs = plt.subplots(ncols=3, nrows=2)
+hs.plot.plot_spectra([s, s2], ax=axs[1, 1:3], style="mosaic")
+
+
+specifying ax
array([<Axes: xlabel='<undefined> (<undefined>)', ylabel='Intensity'>,
+       <Axes: xlabel='<undefined> (<undefined>)', ylabel='Intensity'>],
+      dtype=object)
+
+
+

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

+ +

Gallery generated by Sphinx-Gallery

+
+
+ + +
+ + + + + + + +
+ + + +
+ + +
+
+ +
+ +