Contents
2.pdf
1 Introduction
1.1 Welcome to ggplot2
1.2 Other resources
1.3 What is the grammar of graphics?
1.4 How does ggplot2 fit in with other R graphics?
1.5 About this book
1.6 Installation
1.7 Acknowledgements
3.pdf
2 Getting started with qplot
2.1 Introduction
2.2 Datasets
2.3 Basic use
2.4 Colour, size, shape and other aesthetic attributes
2.5 Plot geoms
2.5.1 Adding a smoother to a plot
2.5.2 Boxplots and jittered points
2.5.3 Histogram and density plots
2.5.4 Bar charts
2.5.5 Time series with line and path plots
2.6 Faceting
2.7 Other options
2.8 Differences from plot
4.pdf
3 Mastering the grammar
3.1 Introduction
3.2 Fuel economy data
3.3 Building a scatterplot
3.4 A more complex plot
3.5 Components of the layered grammar
3.5.1 Layers
3.5.2 Scales
3.5.3 Coordinate system
3.5.4 Faceting
3.6 Data structures
5.pdf
4 Build a plot layer by layer
4.1 Introduction
4.2 Creating a plot
4.3 Layers
4.4 Data
4.5 Aesthetic mappings
4.5.1 Plots and layers
4.5.2 Setting vs. mapping
4.5.3 Grouping
4.5.4 Matching aesthetics to graphic objects
4.6 Geoms
4.7 Stat
4.8 Position adjustments
4.9 Pulling it all together
4.9.1 Combining geoms and stats
4.9.2 Displaying precomputed statistics
4.9.3 Varying aesthetics and data
6.pdf
5 Toolbox
5.1 Introduction
5.2 Overall layering strategy
5.3 Basic plot types
5.4 Displaying distributions
5.5 Dealing with overplotting
5.6 Surface plots
5.7 Drawing maps
5.8 Revealing uncertainty
5.9 Statistical summaries
5.9.1 Individual summary functions
5.9.2 Single summary function
5.10 Annotating a plot
5.11 Weighted data
7.pdf
6 Scales, axes and legends
6.1 Introduction
6.2 How scales work
6.3 Usage
6.4 Scale details
6.4.1 Common arguments
6.4.2 Position scales
6.4.3 Colour
6.4.4 The manual discrete scale
6.4.5 The identity scale
6.5 Legends and axes
6.6 More resources
8.pdf
7 Positioning
7.1 Introduction
7.2 Faceting
7.2.1 Facet grid
7.2.2 Facet wrap
7.2.3 Controlling scales
7.2.4 Missing faceting variables
7.2.5 Grouping vs. faceting
7.2.6 Dodging vs. faceting
7.2.7 Continuous variables
7.3 Coordinate systems
7.3.1 Transformation
7.3.2 Statistics
7.3.3 Cartesian coordinate systems
7.3.4 Non-Cartesian coordinate systems
9.pdf
8 Polishing your plots for publication
8.1 Themes
8.1.1 Built-in themes
8.1.2 Theme elements and element functions
8.2 Customising scales and geoms
8.2.1 Scales
8.2.2 Geoms and stats
8.3 Saving your output
8.4 Multiple plots on the same page
8.4.1 Subplots
8.4.2 Rectangular grids
10.pdf
9 Manipulating data
9.1 An introduction to plyr
9.1.1 Fitting multiple models
9.2 Converting data from wide to long
9.2.1 Multiple time series
9.2.2 Parallel coordinates plot
9.3 !ggplot()! methods
9.3.1 Linear models
9.3.2 Writing your own
11.pdf
10 Reducing duplication
10.1 Introduction
10.2 Iteration
10.3 Plot templates
10.4 Plot functions
12.pdf
Appendices
A Translating between different syntaxes
A.1 Introduction
A.2 Translating between qplot and ggplot
A.2.1 Aesthetics
A.2.2 Layers
A.2.3 Scales and axes
A.2.4 Plot options
A.3 Base graphics
A.3.1 High-level plotting commands
A.3.2 Low-level drawing
A.3.3 Legends, axes and grid lines
A.3.4 Colour palettes
A.3.5 Graphical parameters
A.4 Lattice graphics
A.5 GPL
B Aesthetic specifications
B.1 Colour
B.2 Line type
B.3 Shape
B.4 Size
B.5 Justification
C Manipulating plot rendering with !grid!
C.1 Introduction
C.2 Plot viewports
C.3 Plot grobs
C.4 Saving your work
References
Index
Code index