网页
综合
更新时间 2026-11-14 09:56:44
Data visualization — HyperSpy 2.5.0 documentation
自动蜘蛛
hyperspy.org
正文约 4880 字
Fundamentals and Usage
The object returned by load(), a BaseSignal instance, has a plot() method that is powerful and flexible to visualize n-dimensional data. In this chapter, the visualisation of multidimensional data is exemplified with two experimental datasets: an EELS spectrum image and an EDX dataset consisting of a secondary electron emission image stack and a 3D hyperspectral image, both simultaneously acquired by recording two signals in parallel in a FIB/SEM.
if the object is single spectrum or an image one window will appear when calling the plot method.
If the object is a 1D or 2D spectrum-image (i.e. with 2 or 3 dimensions when including energy) two figures will appear, one containing a plot of the spectrum at the current coordinates and the other an image of the data summed over its spectral dimension if 2D or an image with the spectral dimension in the x-axis if 1D:
Visualisation of a 2D spectrum image.#
Visualisation of a 1D spectrum image.#
Added in version 1.4: Customizable keyboard shortcuts to navigate multi-dimensional datasets.
To change the current coordinates, click on the pointer (which will be a line or a square depending on the dimensions of the data) and drag it around. It is also possible to move the pointer by using the numpad arrows when numlock is on and the spectrum or navigator figure is selected. When using the numpad arrows the PageUp and PageDown keys change the size of the step.
The current coordinates can be either set by navigating the plot(), or specified by pixel indices in s.axes_manager.indices or as calibrated coordinates in s.axes_manager.coordinates.
An extra cursor can be added by pressing the e key. Pressing e once more will disable the extra cursor:
In matplotlib, left and right arrow keys are by default set to navigate the “zoom” history. To avoid the problem of changing zoom while navigating, Ctrl + arrows can be used instead. Navigating without using the modifier keys will be deprecated in version 2.0.
To navigate navigation dimensions larger than 2, modifier keys can be used. The defaults are Shift + left/right and Shift + up/down, (Alt + left/right and Alt + up/down) for navigating dimensions 2 and 3 (4 and 5) respectively. Modifier keys do not work with the numpad.
Hotkeys and modifier keys for navigating the plot can be set in the HyperSpy plot preferences. Note that some combinations will not work for all platforms, as some systems reserve them for other purposes.
If you want to jump to some point in the dataset. In that case you can hold the Shift key and click the point you are interested in. That will automatically take you to that point in the data. This also helps with lazy data as you don’t have to load every chunk in between.
Visualisation of a 2D spectrum image using two pointers.#
Sometimes the default size of the rectangular cursors used to navigate images can be too small to be dragged or even seen. It is possible to change the size of the cursors by pressing the + and - keys when the navigator window is selected.
The following keyboard shortcuts are available when the 1D signal figure is in focus:
Switch second pointer on/off
Change coordinates for dimensions 0 and 1 (typically x and y)
Change coordinates for dimensions 2 and 3
Change coordinates for dimensions 4 and 5
Increase pointer size when the navigator is an image
Decrease pointer size when the navigator is an image
switch the scale of the y-axis between logarithmic and linear
To close all the figures run the following command:
plt.close('all') is a matplotlib command. Matplotlib is the library that HyperSpy uses to produce the plots. You can learn how to pan/zoom and more in the matplotlib documentation
Plotting float16 images is currently not supported by matplotlib; however, it is possible to convert the type of the data by using the change_dtype() method, e.g. s.change_dtype('float32').
Equivalently, if the object is a 1D or 2D image stack two figures will appear, one containing a plot of the image at the current coordinates and the other a spectrum or an image obtained by summing over the image dimensions:
Visualisation of a 1D image stack.#
Visualisation of a 2D image stack.#
Added in version 1.4: l keyboard shortcut
The following keyboard shortcuts are availalbe when the 2D signal figure is in focus:
Change coordinates for dimensions 0 and 1 (typically x and y)
Change coordinates for dimensions 2 and 3
Change coordinates for dimensions 4 and 5
Increase pointer size when the navigator is an image
Decrease pointer size when the navigator is an image
Launch the contrast adjustment tool
switch the norm of the intensity between logarithmic and linear
The image plot can be customised by passing additional arguments when plotting. Colorbar, scalebar and contrast controls are HyperSpy-specific, however matplotlib.axes.Axes.imshow() arguments are supported as well:
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。