plot_pc#

EBSDDetector.plot_pc(mode: str = 'map', return_figure: bool = False, orientation: str = 'horizontal', annotate: bool = False, figure_kwargs: dict | None = None, **kwargs) None | Figure[source]#

Plot all projection centers (PCs).

Parameters:
mode

String describing how to plot PCs. Options are "map" (default), "scatter" and "3d". If mode="map", navigation_dimension must be 2.

return_figure

Whether to return the figure (default is False).

orientation

Whether to align the plots in a "horizontal" (default) or "vertical" orientation.

annotate

Whether to label each pattern with its 1D index into pc_flattened when mode="scatter". Default is False.

figure_kwargs

Keyword arguments to pass to matplotlib.pyplot.figure() upon figure creation. Note that layout="tight" is used by default unless another layout is passed.

**kwargs

Keyword arguments passed to the plotting function, which is imshow() if mode="map", scatter() if mode="scatter" and scatter() if mode="3d".

Returns:
fig

Figure is returned if return_figure=True.

Examples

Create a detector with smoothly changing PC values, extrapolated from a single PC (assumed to be in the upper left corner of a map)

>>> import matplotlib.pyplot as plt
>>> import kikuchipy as kp
>>> det0 = kp.detectors.EBSDDetector(
... shape=(480, 640), pc=(0.4, 0.3, 0.5), px_size=70, sample_tilt=70
... )
>>> det0
EBSDDetector(shape=(480, 640), pc=(0.4, 0.3, 0.5), sample_tilt=70.0, tilt=0.0, azimuthal=0.0, binning=1.0, px_size=70.0 um)
>>> det = det0.extrapolate_pc(
... pc_indices=[0, 0], navigation_shape=(5, 10), step_sizes=(20, 20)
... )
>>> det
EBSDDetector(shape=(480, 640), pc=(0.398, 0.299, 0.5), sample_tilt=70.0, tilt=0.0, azimuthal=0.0, binning=1.0, px_size=70.0 um)

Plot PC values in maps

>>> det.plot_pc()
>>> plt.show()
../../_images/kikuchipy-detectors-EBSDDetector-plot_pc-1_00_00.png

Plot in scatter plots in vertical orientation

>>> det.plot_pc("scatter", orientation="vertical", annotate=True)
>>> plt.show()
../../_images/kikuchipy-detectors-EBSDDetector-plot_pc-1_01_00.png

Plot in a 3D scatter plot, returning the figure for saving etc.

>>> fig = det.plot_pc("3d", return_figure=True)
../../_images/kikuchipy-detectors-EBSDDetector-plot_pc-1_02_00.png

Examples using EBSDDetector.plot_pc#

Estimate tilts about the detector x and z axis

Estimate tilts about the detector x and z axis