Color Tools

[This article was first published on jfisher-usgs, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Colors are mysterious business and choosing the right color or color palette for an R graphics can sometimes be a chore. To alleviate this burden, I present two functions for choosing color values.

To access these functions install the RSurvey and dichromat packages:

install.packages(c("RSurvey", "dichromat"))
library(RSurvey)

Choose Color

The first function, ChooseColor (source), calls upon a graphical user interface (GUI) for choosing a color in the HSV color space (fig. 1).

col <- ChooseColor(col = "#669933")

center

Figure 1: A screenshot of the HSV color tool.

Choose Color Palette

The second function, ChoosePalette (source), calls upon a GUI for choosing a color palette in the HCL (Hue, Chroma, and Luminance) color space (fig. 2).

pal <- ChoosePalette(terrain_hcl)

center

Figure 2: A screenshot of the HCL color palette tool.

An example graphic accompanies the GUI and may be used to evaluate the robustness of individual color schemes (fig. 3).

center

Figure 3: Example graphic based on selected color palette.

The ChoosePalette function may eventually reside in the colorspace package.

To leave a comment for the author, please follow the link and comment on their blog: jfisher-usgs.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)