Albert Y. Kim
Monday 2016/2/22
At its simplest: A statistical graphic is a mapping of variables in a
data set to aes()thetic attributies of geom_etric objects.These are, in my view, the most important components to think about.
Famous graphical illustration by Minard of Napolean's march to and retreat from Moscow in 1812
6 dimensions (variables) of information on a 2 dimensional page:
Top Map:
data |
aes() |
geom_ |
|---|---|---|
| longitude | x |
point |
| latitude | y |
point |
| army size | size |
path |
| forward vs retreat | color |
path |
Bottom Graph:
data |
aes() |
geom_ |
|---|---|---|
| date | x |
line |
| temperature | y |
line |
Load this in R:
simple <-
data.frame(
A = c(2,1,4,9),
B = c(3,2,5,10),
C = c(4,1,15,80),
D = c("a", "a", "b", "b")
)
Run each of these individually:
ggplot(data=simple, aes(x=A, y=B)) + geom_point()
ggplot(data=simple, aes(x=A, y=B, color=D)) + geom_point()
ggplot(data=simple, aes(x=A, y=B, shape=D)) + geom_point()
Quotes from paper:
Note the key words: iterative, framework, and customized.
Packages for interactive graphics include
ggvis: in development by Wickhamplotly: from the creators of http://www.plot.lyshiny: later in the course. Install the shiny package -> File -> New
File -> Shiny Web App… -> Single File -> Click on “Rup App”and many, many more…