Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random colors for grains, but with a given seed #45

Open
CsatiZoltan opened this issue Nov 29, 2020 · 0 comments
Open

Random colors for grains, but with a given seed #45

CsatiZoltan opened this issue Nov 29, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request visualization Visualization
Milestone

Comments

@CsatiZoltan
Copy link
Owner

CsatiZoltan commented Nov 29, 2020

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.

@CsatiZoltan CsatiZoltan added the enhancement New feature or request label Nov 29, 2020
@CsatiZoltan CsatiZoltan added this to the v1.1.0 milestone Nov 29, 2020
@CsatiZoltan CsatiZoltan self-assigned this Nov 29, 2020
@CsatiZoltan CsatiZoltan added the visualization Visualization label Dec 4, 2020
@CsatiZoltan CsatiZoltan modified the milestones: v1.1.0, Future Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request visualization Visualization
Projects
None yet
Development

No branches or pull requests

1 participant