Open
Description
When plotting the same grain configuration twice, the displayed colors are different because colors are randomly allocated to each grain. This is not only annoying when making comparisons, but it can also deceive people who do not know about the random color allocation.
The solution is to use a given seed for the random number generator. Then the same colors are used for subsequent plotting.
from numpy.random import default_rng
rng = default_rng(seed) # uses the PCG64 generator
vals = rng.random((m, n))
See also #9.
Implement it in the analysis module as show_label_image
.