Plot Colour Helper – Finally an easy way to pick colours for your R plots!

January 9, 2017
By

(This article was first published on Dean Attali's R Blog, and kindly contributed to R-bloggers)

You’ve just made an amazing plot in R, and the only thing remaining is finding the right colours to use. Arghhh this part is never fun… You’re probably familiar with this loop: try some colour values -> plot -> try different colours -> plot -> repeat. Don’t you wish there was a better way?

Well, now there is 🙂

If you’ve ever had to spend a long time perfecting the colour scheme of a plot, you might find the new Plot Colour Helper handy. It’s an RStudio addin that lets you interactively choose combinations of colours for your plot, while updating your plot in real-time so you can see the colour changes immediately.

Demo of colour picker addin

This new tool is available from the colourpicker package.

To use this tool, either call the plotHelper() function or highlight code for a plot and select the addin through the RStudio Addins menu. The colours you select in the tool will be available to your code as a variable named CPCOLS.

The Plot Colour Helper has many little extra features that are designed to make working with it as efficient as possible. For example, you can initialize the tool with a specified set of colours or you can let the tool guess how many colours are needed based on your plot code. There are also several keyboard shortcuts for your convenience.

Here is a short demo of the tool:

Plot Colour Helper demo

Fun fact: this tool was born thanks to my girlfriend’s blunt feedback. I had previously made a Colour Picker addin, which lets you select colours in RStudio and get the resulting colour list as a vector. When I saw my girlfriend creating lots of plots for her thesis and spending a lot of time on colour selecting and re-plotting, I told her she can use my Colour Picker to help with the process. She told me that it’s pretty much useless since she can’t actually see the plot update while choosing colours. So me, being the best boyfriend in the universe (and an R addict), I immediately proceeded to create the Plot Colour Helper for her. And for all of you!

Go ahead and install colourpicker to get started. I hope you find this addin useful, and as always – feedback is welcomed.

To leave a comment for the author, please follow the link and comment on their blog: Dean Attali's R Blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Sponsors

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)