16 February 2017
The grammar of graphics determines how
interact.
Select variables (load the data)
ggplot(iris) +
Map aesthetics (x, y, colour, fill, size, …)
aes(x = Petal.Width, y = Petal.Length, colour = Species) +
Set scales for your aesthetics (continuous, discrete, log, sqrt, …)
scale_x_continuous() + scale_y_continuous() + scale_colour_discrete() +
Choose geometries and/or statistics
geom_point() + stat_density_2d() +
Pick a coordinate system and transformations
coord_cartesian()
Install and load the package
devtools::install_github('Selbosh/ggChernoff') library(ggplot2) library(ggChernoff)
Create a simple scatter plot of faces
p <- ggplot(iris) + aes(x = Petal.Width, y = Petal.Length, fill = Species) + geom_chernoff()
Map to the new smile aesthetic
p + aes(smile = Sepal.Width)