randomcoloR icon indicating copy to clipboard operation
randomcoloR copied to clipboard

Color selection not reproducible with set.seed

Open venpopov opened this issue 6 years ago • 3 comments

set.seed(1985)
randomColor(N, hue='orange')

This should produce the same output every time its run.

venpopov avatar Dec 28 '19 17:12 venpopov

As far as I can tell, there is no way to get the same colors with a specific hue every time, but you can get a reproducible set of distinct colors if you run set.seed(1985); distinctColorPalette(N). I know that probably doesn't help your use case, but wanted to point it out for others.

cypressf avatar Apr 10 '20 14:04 cypressf

Yes. It can now. See the new PR #14 .

See these two runs. Technically speaking, the colors are not exactly the same, but visually speaking, they look the same.

scales::show_col(randomcoloR::randomColor(10, hue='orange', seed=10))
scales::show_col(randomcoloR::randomColor(10, hue='orange', seed=10))
Screen Shot 2020-05-03 at 12 00 30 PM Screen Shot 2020-05-03 at 12 00 39 PM

Puriney avatar May 03 '20 17:05 Puriney

I am running this package in version 1.1.0.1; The randomColor function does not accept the seed argument.

library(randomcoloR)
#> Warning: package 'randomcoloR' was built under R version 3.6.3
scales::show_col(randomcoloR::randomColor(10, hue='orange', seed=10))
#> Error in randomcoloR::randomColor(10, hue = "orange", seed = 10): unused argument (seed = 10)

Created on 2020-10-10 by the reprex package (v0.3.0)

Sibojang9 avatar Oct 11 '20 05:10 Sibojang9