Crayola, the ubiquitous crayon company, credits statistical analysis to its recent success in improving efficiency (Minitab, 2015). Is there a way to enhance your statistical analysis with Crayola colors? Lucky for you (and/or your inner child), now there is. Dr. Karl Broman, a professor in Biostatistics and Medical Informatics at the University of Wisconsin-Madison, felt disappointed in the lack of Crayola options in R, and has developed an array of Crayola colors within his statistical package “Broman” (2014). Broman also contains useful functions related to graphics and permutation tests.
To view an attractive diagram of available colors type the following:
To print a list of the hex codes for possible colors, suitable for ggplot2, use the following command:
Now, to assign a color scheme; Broman will recognize partial matches, so you can type part of the name of your favorite crayons to select it.
my_colors = crayons(c(“pacific”, “dandelion”))
poll <- c(1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2)
poll = factor(poll,
levels = c(1, 2),
labels = c(“Yes”, “No” ))
counts <- table(poll)
xlab=”Should The Dandelion Crayon Be Retired?”, ylab=”Frequency of Response”)
As you can see, now your charts in R can be as wild as your imagination! Special thanks to Dr. Broman for helping me configure this code.
Broman, K. (2014). Crayon colors in R. R-Bloggers. Retrieved from https://www.r-bloggers.com/crayon-colors-in-r/
Broman, K. (2017). Broman: Karl Broman’s R code. R Package version 0.65-4, https://cran.r-project.org/web/packages/broman/broman.pdf
Minitab, Inc. (2015). The color of quality: How Crayola uses data to deliver the perfect crayon. Quality Magazine. Retrieved from https://www.qualitymag.com/ext/resources/files/white_papers/Crayola.pdf