If you want to use crayon colors in R but you don’t want to rely on my R/broman package, you can just grab the code. Copy the relevant lines from the R/brocolors.R
file:
crayons = c("Almond"="#efdecd", "Antique Brass"="#cd9575", "Apricot"="#fdd9b5", ... "Yellow Green"="#c5e384", "Yellow Orange"="#ffb653")
I spent a bit of time thinking about how best to sort the colors in a meaningful way, for the plot_crayons()
function. But then decided to stop thinking and just do something brainless: measure distance between colors by RMS difference of the RGB values, and then use hierarchical clustering. Here’s the code from plot_crayons()
:
# get rgb colval <- t(col2rgb(crayons)) # hclust to order the colors ord <- hclust(dist(colval))$order
It’s not perfect, but I think it worked remarkably well:
8 May 2014 at 12:47 pm
just curious, don’t you have a graduate student to work out these technical details for you?
8 May 2014 at 1:09 pm
Why let graduate students have all the fun?
8 May 2014 at 12:51 pm
Looks pretty good to me as well! Another way might be to cluster according to HSV values – but that still needs some more thought. Hue is perhaps best thought of as cyclical in that color space – so a non-lazy distance metric may be harder to come by.
8 May 2014 at 1:17 pm
Meh – maybe ignore that train. Just tried it using euclidean distance in HSV space – I like the rgb results better though. See https://www.dropbox.com/sh/8xktu9ugso7ra11/AADEFItO_HOUj9pX6-ed25i8a
8 May 2014 at 1:23 pm
I could probably use the 2d layout better, but I really shouldn’t spend any more time on this.
8 May 2014 at 2:40 pm
It does seem to make a good list of colours. I’m curious, though: why, if green is one of the primary colours, are there several episodes of green (the first, fifth and sixth columns), whereas the reds are basically all together, and the blues ditto?
8 May 2014 at 2:42 pm
My effort at ordering the colors was simplistic and less than ideal.
26 Apr 2016 at 9:17 am
[…] useful change for the colors would be sorting in a logical order. They are just currently in alphabetical. I am too lazy though to convert the colors to a […]