Plot Colour Helper – Finally an easy way to pick colours for your R plots!
This article is originally published at https://deanattali.com
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.
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
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:
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!
Please visit source website for post related comments.