A collection of wrapper functions for graphics. The objective of this package is to make plotting easier for R beginners.
This package depends on the following packages:
- ggplot2 (available on CRAN)
- stringr (available on CRAN)
- reshape2 (available on CRAN)
- dichromat (available on CRAN)
- picante (available on CRAN)
- colorspace (available on CRAN)
- EBImage (available on Bioconductor)
- rblocks (available on GitHub)
## CRAN Packages
install.packages(c("ggplot2", "stringr", "reshape2", "dichromat"))
## EBImage
source("http://bioconductor.org/biocLite.R")
biocLite("EBImage")
## Packages on GitHub
library(devtools)
install_github("ramnathv/rblocks")
## And finally ...
install_github("woobe/rPlotter")
This function extracts dominant colours from images and then returns colour hex code.
library(rPlotter)
## Using the R Logo
pal_r <- extract_colours("http://developer.r-project.org/Logo/Rlogo-1.png")
par(mfrow = c(1,2))
pie(rep(1, 5), col = pal_r, main = "Palette based on R Logo")
hist(Nile, breaks = 5, col = pal_r, main = "Palette based on R Logo")
## Using a poster from the movie "Kill Bill"
pal_kb <- extract_colours("http://www.moviegoods.com/Assets/product_images/1010/477803.1010.A.jpg")
par(mfrow = c(1,2))
pie(rep(1, 5), col = pal_kb, main = "Palette based on Kill Bill")
hist(Nile, breaks = 5, col = pal_kb, main = "Palette based on Kill Bill")
## Using Homer Simpson
pal_s <- extract_colours("http://haphappy.com/wp-content/uploads/2011/03/homerbeer2.png")
par(mfrow = c(1,2))
pie(rep(1, 5), col = pal_s, main = "Palette based on Simpsons")
hist(Nile, breaks = 5, col = pal_s, main = "Palette based on Simpsons")
This function displays colours as rblocks.
set.seed(1234)
pal_pf <- extract_colours("http://www.scoutlondon.com/blog/wp-content/uploads/2012/05/Pulp-Fiction.jpg")
display_colours(pal_pf)
The functions simulates three types of colour blindness and then displays the simulated colours as rblocks.
set.seed(1234)
pal_pf <- extract_colours("http://www.scoutlondon.com/blog/wp-content/uploads/2012/05/Pulp-Fiction.jpg")
simulate_colours(pal_pf)
- Original K-means Palette by dsparks https://gist.github.com/dsparks/3980277
- Karthik Ram for the original wesanderson palette generator.
- Russell Dinnage and Noam Ross for new ideas and suggestions.
- Ramnath Vaidyanathan for rblocks.
- 'xkcd' theme from http://drunks-and-lampposts.com/2012/10/02/clegg-vs-pleb-an-xkcd-esque-chart/
- 'blank' theme from http://is-r.tumblr.com/post/32728434389/a-replacement-for-theme-blank
- Radar chart from http://statisticstoproveanything.blogspot.co.uk/2013/11/spider-web-plots-in-r.html