Crayon colors in R

Last night I was working on a talk on creating effective graphs. Mostly, I needed to update the colors, as there’d been some gaudy ones in its previous form (e.g., slide 22).

I usually pick colors using the crayons in the Mac Color Picker. But that has just 40 crayons, and I wanted more choices.

That led me to the list of Crayola crayon colors on wikipedia. I wrote a ruby script to grab the color names and codes and added them to my R/broman package.

Use brocolors("crayons") to get the list of colors. For example, to get “Tickle Me Pink,” use

library(broman)
pink <- brocolors("crayons")["Tickle Me Pink"]

Use plot_crayons() to get the following summary plot of the colors:

Crayon colors

You can install the R/broman package using install_github in devtools, (specifically, install_github("kbroman/broman")) or wait a day or two and the version with this code will be on CRAN.

Update: See also Two more points about crayon colors.

About these ads

Tags: ,

6 Responses to “Crayon colors in R”

  1. annoporci Says:

    Very nice, I’m keen to give it a try.

    > library(“broman”)
    > pink <- brocolors("crayons")["Tickle Me Pink"]
    Error: could not find function "brocolors"

    Tried this: install.packages("broman", type = "source"), got this: broman_0.48-2.tar.gz, but still the Error message above. Any other packages needed? Am I forgetting something obvious? Thanks.

    • annoporci Says:

      install_github(“kbroman/broman”)

      ends with:

      Warning message:
      package ‘’ is not available (for R version 3.1.0)

    • Karl Broman Says:

      Weird; does packageVersion(“broman”) indicate 0.48.2? Can you use any of the other functions in the package? For example, dec2hex(200)

      I’m having similar problems with install_github. I’m not sure what’s up.

    • Karl Broman Says:

      If I use remove.packages(“broman”) and then install_github(“kbroman/broman”), I still get that warning, but it does work.

  2. beckmw Says:

    I greatly appreciate your top 10 horrible figures… perhaps also an example of the peer review process gone awry!

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 87 other followers