# Visualizing patterns¶

The EBSD and EBSDMasterPattern object has a powerful and versatile plot() method provided by HyperSpy. Its uses are greatly detailed in HyperSpy’s visualisation user guide. This section details example uses specific to EBSD and EBSDMasterPattern objects.

Note

The Nickel data set used in this section can be downloaded from [Anes2019].

## Plot multiple scans¶

HyperSpy provides the function plot_signals() to plot multiple signals with the same navigator, as explained in the HyperSpy user guide. This enables e.g. plotting of experimental and simulated patterns side by side as a visual inspection of the indexing results:

>>> import hyperspy.api as hs
>>> import h5py
>>> with h5py.File('/path/to/simulated_patterns/sim.h5', mode='r') as f:
patterns = f['EMData/EBSD/EBSDPatterns'][()]
>>> s_sim = kp.signals.EBSD(patterns.reshape(s.data.shape))
>>> hs.plot.plot_signals([s, s_sim], navigator=s_om)


Plotting of experimental and simulated patterns side by side for visual inspection, using an orientation map as navigator.

## Plot master patterns¶

EBSDMasterPattern objects can be navigated along their energy axis and/or the their northern/southern hemisphere:

>>> s
<EBSDMasterPattern, title: , dimensions: (2, 11|1001, 1001)>
>>> s.axes_manager
<Axes manager, axes: (11, 2|1001, 1001)>
Name |   size |  index |  offset |   scale |  units
================ | ====== | ====== | ======= | ======= | ======
energy |     11 |      9 |      10 |       1 |    keV
y |      2 |      0 |       0 |       1 | hemisphere
---------------- | ------ | ------ | ------- | ------- | ------
width |   1001 |        |  -5e+02 |       1 |     px
height |   1001 |        |  -5e+02 |       1 |     px
>>> s.plot()


A spherical projection of the northern hemisphere at 19 keV for Ni (top) from an EMsoft simulation. A navigator (bottom) for EBSDMasterPattern objects, with the beam energy along the horizontal axis and the northern and southern hemispheres along the vertical axis, is also shown.