Martin's suggestion is the way to go. For display purposes, you basically
never want random colors, you almost always want to select distinct colors
and there are principled ways of doing that.
Best,
Kasper
On Tue, Nov 30, 2021 at 6:59 AM Martin Morgan
wrote:
> Check out grDevices::hcl.pals (al
Check out grDevices::hcl.pals (also
https://www.zeileis.org/papers/Zeileis+Hornik+Murrell-2009.pdf) or the
RColorBrewer package (also https://colorbrewer2.org) for principled selection
of colors. Sounds like you're interested in 'qualitative' color palletes.
Martin Morgan
On 11/29/21, 4:23 PM
Thanks, and good to know the with_seed function.
best,
Chen
On 29.11.21 22:43, Henrik Bengtsson wrote:
The easiest is to use withr::with_seed(), e.g.
withr::with_seed(seed = 42L, randomcoloR::distinctColorPalette(6))
[1] "#A0E1BC" "#B8E363" "#D686BE" "#DEA97F" "#B15CD8" "#A2B9D5"
withr::wit
The easiest is to use withr::with_seed(), e.g.
> withr::with_seed(seed = 42L, randomcoloR::distinctColorPalette(6))
[1] "#A0E1BC" "#B8E363" "#D686BE" "#DEA97F" "#B15CD8" "#A2B9D5"
> withr::with_seed(seed = 42L, randomcoloR::distinctColorPalette(6))
[1] "#A0E1BC" "#B8E363" "#D686BE" "#DEA97F" "#B15
Thanks. I think it may work in theory, generating "enough" distinct colors
is fairly easy. Then the problem will be how to find a subset of colors of
size n, and the selected colors are still most distinguishable. I think I
will do this with my eyes if no other methods, a tedious job.
But at least
It appears that you don't actually want random colors, but instead you want the
same colors each time. Why not just generate the vector of 'random distinct
colors' one time and save the vector of colors?
-Original Message-
From: Bioc-devel On Behalf Of Meng Chen
Sent: Monday, November 2