03 July 2014

Leland Wilkinson (1999)

Book: The Grammar of Graphics

Grammar: “the fundamental principles or rules of an art or science”

"…rules for constructing graphs mathematically and then representing them as graphics aesthetically."

ggplot2

  • Developed by Hadley Wickam (2007)
  • Takes the good things of lattice with the underlying layered grammar of graphics approach.
  • Easy to draw wide range of graphics with compact syntax and independent components

Lets create a humble chart

areas <- c("N", "E", "W", "S", "C")
sales <- c(5, 25, 15, 20, 10)
profit <- c(2, 8, 6, 5, 3)
humble <- data.frame(areas, sales, profit)
humble$areas <-ordered(humble$areas, levels=c("N", "E", "W", "S", "C"))
humble
##   areas sales profit
## 1     N     5      2
## 2     E    25      8
## 3     W    15      6
## 4     S    20      5
## 5     C    10      3

Cartesian

plot of chunk cartesian

Cartesian Flip

plot of chunk cartesian-flip

Polar - X

plot of chunk polar-x

Polar - Y