ggplot
Summary:
ggplot
is plotting package for the future of R
computingggplot
acts like a grammar - we are able to extend the layers iterativeggplot()
defines global information for all following elements (relative to data and aes
mappings)aes
allows you to define how to map columns of a data.frame to aesthetics of the graphicgeom_...
define geometric attributes of the graphicfacets
allow one to divide the graphic up conditional on a factor variableVisualization Theory
This part lecture is a combination of a blog a wrote a long time ago - that has lots of spelling errors and a compression of common theory that is sometime taught in 315.
Why Graphics
When graphics (Maybe better to ask “when not graphics”)
~Tufte, The Visual Display of Information, pg 20 and pg 178 (see extra reading for Hw 2)
Rules to make Good Graphics:
Human Preception
General dos & don’t for graphics
preserve the size of effect / differences in the data
Tufte suggests optimizing the Lie Factor: \[\mathrm{Lie\ Factor} = \frac{\mathrm{size\ of\ the\ effect\ in\ the\ graph}}{\mathrm{size\ of\ the\ effect\ in\ the\ data}}\]