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"
. Ifmode="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
whenmode="scatter"
. Default isFalse
.- figure_kwargs
Keyword arguments to pass to
matplotlib.pyplot.figure()
upon figure creation. Note thatlayout="tight"
is used by default unless another layout is passed.- **kwargs
Keyword arguments passed to the plotting function, which is
imshow()
ifmode="map"
,scatter()
ifmode="scatter"
andscatter()
ifmode="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, twist=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, twist=0.0, binning=1.0, px_size=70.0 um)
Plot PC values in maps
>>> det.plot_pc() >>> plt.show()
Plot in scatter plots in vertical orientation
>>> det.plot_pc("scatter", orientation="vertical", annotate=True) >>> plt.show()
Plot in a 3D scatter plot, returning the figure for saving etc.
>>> fig = det.plot_pc("3d", return_figure=True)
Examples using EBSDDetector.plot_pc
#
Estimate tilts about the detector x and z axis