SpanROI on signal axis#

Use a SpanROI interactively on a Signal1D.

import hyperspy.api as hs

Create a signal:

Create the roi, here a SpanROI for one dimensional ROI:

roi = hs.roi.SpanROI(left=10, right=20)

Slice signal with roi with the ROI. By using the interactive function, the output signal s_roi will update automatically. The ROI will be added automatically on the signal figure.

Specify the axes to add the ROI on either the navigation or signal dimension:

s.plot()
sliced_signal = roi.interactive(s, axes=s.axes_manager.signal_axes)
# Choose the second figure as gallery thumbnail:
# sphinx_gallery_thumbnail_number = 2
  • Two Gaussians Navigator
  • Two Gaussians Signal

Plot the signal sliced by the ROI and use autoscale='xv' to update the limits of the plot automatically:

sliced_signal.plot(autoscale='xv')
  • Two Gaussians Navigator
  • Two Gaussians Signal

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

Gallery generated by Sphinx-Gallery