20100929 ggplot - triangle users group presentation
DESCRIPTION
TRANSCRIPT
ggplot2
Elaine McVeyBD Technologies
Triangle Area R useRs Group
September 29, 2010
What is ggplot2?
ggplot2 is an R package written by Hadley Wickham that provides a comprehensive framework for statistical graphics based on The Grammar of Graphics (LeLand Wilkinson, 2005)
Goal
To show you enough about ggplot2 that you can understand its capabilities, get started using it, and know where to learn more.
Benefits
• Since ggplot2 has an underlying conceptual framework, it becomes very powerful once you understand it.
• ggplot2 code is concise and readable• Writing statistical functions (i.e. panel functions) for
ggplot2 is relatively easy.• ggplot2 enforces the link between the data and the
legend, so labeling errors are minimized.• The layering concept makes it easy to combine data
from different dataframes in a single plot.• The active user community provides a good place to get
help and drives ongoing development.
Jumping In - Dataframe
Jumping In – First Plot
Layers
More Layers - oops
More Layers - corrected
Non-Mapped Attributes
Accidental Aesthetic Mapping
Aesthetic Mapping by geom
Bigger Dataframe
Facets and Colors
Statistical Summaries
Creating errBars
Lattice Comparison
Expanding errBars
Layering Dataframes
plyr aside:
Layering Dataframes in geoms
Updating Plots
Where to go next
1) ggplot2: Elegant Graphics for Data Analysis(skip qplot)
2) had.co.nz/ggplot2 (& plyr & reshape . . . )
3) Google group listserv
Def
ault
stat
istic
s an
d ae
sthe
tics
for
each
geo
m