plot#

EBSDDetector.plot(coordinates: str = 'detector', show_pc: bool = True, pc_kwargs: dict | None = None, pattern: ndarray | None = None, pattern_kwargs: dict | None = None, draw_gnomonic_circles: bool = False, gnomonic_angles: None | list | ndarray = None, gnomonic_circles_kwargs: dict | None = None, zoom: float = 1, return_figure: bool = False) None | Figure[source]#

Plot the detector screen viewed from the detector towards the sample.

The plotting of gnomonic circles and general style is adapted from the supplementary material to [Britton et al., 2016] by Aimo Winkelmann.

Parameters:
coordinates

Which coordinates to use, "detector" (default) or "gnomonic".

show_pc

Show the average projection center in the Bruker convention. Default is True.

pc_kwargs

A dictionary of keyword arguments passed to matplotlib.axes.Axes.scatter().

pattern

A pattern to put on the detector. If not given, no pattern is displayed. The pattern array must have the same shape as the detector.

pattern_kwargs

A dictionary of keyword arguments passed to matplotlib.axes.Axes.imshow().

draw_gnomonic_circles

Draw circles for angular distances from pattern. Default is False. Circle positions are only correct when coordinates="gnomonic".

gnomonic_angles

Which angular distances to plot if draw_gnomonic_circles=True. Default is from 10 to 80 in steps of 10.

gnomonic_circles_kwargs

A dictionary of keyword arguments passed to matplotlib.patches.Circle().

zoom

Whether to zoom in/out from the detector, e.g. to show the extent of the gnomonic projection circles. A zoom > 1 zooms out. Default is 1, i.e. no zoom.

return_figure

Whether to return the figure. Default is False.

Returns:
fig

Matplotlib figure instance, if return_figure is True.

Examples

>>> import matplotlib.pyplot as plt
>>> import kikuchipy as kp
>>> det = kp.detectors.EBSDDetector(
...     shape=(60, 60),
...     pc=(0.4, 0.8, 0.5),
...     convention="tsl",
...     sample_tilt=70,
... )
>>> det.plot()
>>> plt.show()
../../_images/kikuchipy-detectors-EBSDDetector-plot-1_00_00.png

Plot with gnomonic coordinates and circles

>>> det.plot(
...     coordinates="gnomonic",
...     draw_gnomonic_circles=True,
...     gnomonic_circles_kwargs={"edgecolor": "b", "alpha": 0.3}
... )
>>> plt.show()
../../_images/kikuchipy-detectors-EBSDDetector-plot-1_01_00.png

Plot a pattern on the detector and return it for saving etc.

>>> s = kp.data.nickel_ebsd_small()
>>> fig = det.plot(pattern=s.inav[0, 0].data, return_figure=True)
../../_images/kikuchipy-detectors-EBSDDetector-plot-1_02_00.png