pyxem / kikuchipy

Toolbox for analysis of electron backscatter diffraction (EBSD) patterns
https://kikuchipy.org
GNU General Public License v3.0
79 stars 30 forks source link

Allow specifying a color for simulator reflectors #599

Closed hakonanes closed 1 year ago

hakonanes commented 1 year ago

Description of the change

This PR enables passing a valid Matplotlib color to color simulator reflectors in KikuchiPatternSimulator.plot() when plotting with Matplotlib (not PyVista).

This is useful when you want to plot more than one phase's reflectors in the same (stereographic) plot, coloring one red and one blue, e.g.

Also, contrast with linear or square scaling (of intensities from structure factors) is improved.

Progress of the PR

Minimal example of the bug fix or new feature

>>> from diffsims.crystallography import ReciprocalLatticeVector
>>> import kikuchipy as kp
>>> mp_si = kp.data.si_ebsd_master_pattern(allow_download=True, lazy=True)  # Get Si phase
>>> rlv = ReciprocalLatticeVector(mp_si.phase, hkl=[[1, 1, 1], [2, 2, 0], [4, 0, 0]])
>>> rlv = rlv.symmetrise()
>>> rlv.sanitise_phase()
>>> rlv.calculate_structure_factor()
>>> simulator = kp.simulations.KikuchiPatternSimulator(rlv)
>>> simulator.plot(color="r")

test

For reviewers