Manual

Submitted by: Submitted by

Views: 113

Words: 14115

Pages: 57

Category: Science and Technology

Date Submitted: 10/26/2013 11:44 AM

Report This Essay

ggplot2: elegant graphics for data analysis

Hadley Wickham February 24, 2009

Contents

1. Preface 1.1. Introduction . . . . . . . . . . . . . 1.2. Other resources . . . . . . . . . . . 1.3. What is the grammar of graphics? 1.4. How does ggplot2 fit in with other 1.5. About this book . . . . . . . . . . 1.6. Installation . . . . . . . . . . . . . 1.7. Acknowledgements . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . R graphics? . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

1 1 2 2 3 4 5 6 7 7 7 8 10 11 12 15 16 17 18 20 22 23 25 25 26 26 31 33 35 35 36 36 36

2. Getting started with qplot 2.1. Introduction . . . . . . . . . . . . . . . . . . . . . 2.2. Data sets . . . . . . . . . . . . . . . . . . . . . . 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 . . . . . . . . . . . . . . . . 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 . . . . . . . ....