Two more points about crayon colors

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:

Crayon colors

About these ads

Tags: , ,

7 Responses to “Two more points about crayon colors”

  1. Wei Zou Says:

    just curious, don’t you have a graduate student to work out these technical details for you?

  2. apwheele Says:

    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.

  3. apwheele Says:

    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

  4. Ken Butler Says:

    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?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

Join 98 other followers