plot#

Window.plot(grid: bool = True, show_values: bool = True, textcolors: List[str] | None = None, cmap: str = 'viridis', cmap_label: str = 'Value', colorbar: bool = True, return_figure: bool = False) Figure[source]#

Plot window values with indices relative to the origin.

Parameters:
grid

Whether to separate each value with a white spacing in a grid. Default is True.

show_values

Whether to show values as text in centre of element. Default is True.

textcolors

A list of two color specifications. The first is used for values below a threshold, the second for those above. If not given (default), this is set to ["white", "black"].

cmap

A colormap to color data with, available in matplotlib.colors.ListedColormap. Default is "viridis".

cmap_label

Colormap label. Default is "Value".

colorbar

Whether to show the colorbar. Default is True.

return_figure

Whether to return the figure. Default is False.

Returns:
fig

Figure returned if return_figure=True.

Examples

A plot of window data with indices relative to the origin, showing element values and x/y ticks, can be produced and written to file

>>> import kikuchipy as kp
>>> w = kp.filters.Window()
>>> fig = w.plot(return_figure=True)
>>> fig.savefig('my_kernel.png')
../../_images/kikuchipy-filters-Window-plot-1.png