plot#

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

Plot the detector screen.

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 kikuchipy as kp
>>> det = kp.detectors.EBSDDetector(
...     shape=(60, 60),
...     pc=(0.4, 0.8, 0.5),
...     convention="tsl",
...     sample_tilt=70,
... )
>>> det.plot()

Plot with gnomonic coordinates and circles

>>> det.plot(
...     coordinates="gnomonic",
...     draw_gnomonic_circles=True,
...     gnomonic_circles_kwargs={"edgecolor": "b", "alpha": 0.3}
... )

Plot a pattern on the detector and save it

>>> s = kp.data.nickel_ebsd_small()
>>> fig = det.plot(pattern=s.inav[0, 0].data, return_figure=True)
>>> # fig.savefig("detector.png")
../../_images/kikuchipy-detectors-EBSDDetector-plot-1_00.png
../../_images/kikuchipy-detectors-EBSDDetector-plot-1_01.png
../../_images/kikuchipy-detectors-EBSDDetector-plot-1_02.png