Skip to content
/ rPlotter Public

Wrapper functions that make plotting in R a lot easier for beginners.

License

Notifications You must be signed in to change notification settings

woobe/rPlotter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rPlotter

A collection of wrapper functions for graphics. The objective of this package is to make plotting easier for R beginners.

Dependencies

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)

Installation

## 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")

Example: extract_colours(...)

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")

output_1a

## 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")

output_1b

## 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")

output_1c

Example: display_colours(...)

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)

output_disp

Example: simulate_colours(...)

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)

output_sim

Related Blog Posts

blog_1a

Credits

About

Wrapper functions that make plotting in R a lot easier for beginners.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages