SkillAgentSearch skills...

RPlotter

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

Install / Use

/learn @woobe/RPlotter
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

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

  • 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
View on GitHub
GitHub Stars81
CategoryDevelopment
Updated7mo ago
Forks18

Languages

R

Security Score

87/100

Audited on Aug 5, 2025

No findings