ggplot2 (eBook)

Elegant Graphics for Data Analysis

(Autor)

eBook Download: PDF
2009 | 2009
VIII, 213 Seiten
Springer New York (Verlag)
978-0-387-98141-3 (ISBN)

Lese- und Medienproben

ggplot2 - Hadley Wickham
Systemvoraussetzungen
64,19 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

Provides both rich theory and powerful applications

Figures are accompanied by code required to produce them

Full color figures


1. 1 Welcome to ggplot2 ggplot2 is an R package for producing statistical, or data, graphics, but it is unlike most other graphics packages because it has a deep underlying grammar. This grammar, based on the Grammar of Graphics (Wilkinson, 2005), is composed of a set of independent components that can be composed in many di?erent ways. This makesggplot2 very powerful, because you are not limited to a set of pre-speci?ed graphics, but you can create new graphics that are precisely tailored for your problem. This may sound overwhelming, but because there is a simple set of core principles and very few special cases, ggplot2 is also easy to learn (although it may take a little time to forget your preconceptions from other graphics tools). Practically,ggplot2 provides beautiful, hassle-free plots, that take care of ?ddly details like drawing legends. The plots can be built up iteratively and edited later. A carefully chosen set of defaults means that most of the time you can produce a publication-quality graphic in seconds, but if you do have special formatting requirements, a comprehensive theming system makes it easy to do what you want. Instead of spending time making your graph look pretty, you can focus on creating a graph that best reveals the messages in your data.

Contents 5
1 Introduction 9
1.1 Welcome to ggplot2 9
1.2 Other resources 10
1.3 What is the grammar of graphics? 11
1.4 How does ggplot2 fit in with other R graphics? 12
1.5 About this book 13
1.6 Installation 14
1.7 Acknowledgements 14
2 Getting started with qplot 16
2.1 Introduction 16
2.2 Datasets 17
2.3 Basic use 18
2.4 Colour, size, shape and other aesthetic attributes 19
2.5 Plot geoms 20
2.5.1 Adding a smoother to a plot 21
2.5.2 Boxplots and jittered points 23
2.5.3 Histogram and density plots 25
2.5.4 Bar charts 27
2.5.5 Time series with line and path plots 27
2.6 Faceting 29
2.7 Other options 30
2.8 Differences from plot 33
3 Mastering the grammar 34
3.1 Introduction 34
3.2 Fuel economy data 35
3.3 Building a scatterplot 36
3.4 A more complex plot 41
3.5 Components of the layered grammar 42
3.5.1 Layers 44
3.5.2 Scales 44
3.5.3 Coordinate system 45
3.5.4 Faceting 45
3.6 Data structures 46
4 Build a plot layer by layer 48
4.1 Introduction 48
4.2 Creating a plot 49
4.3 Layers 49
4.4 Data 52
4.5 Aesthetic mappings 53
4.5.1 Plots and layers 53
4.5.2 Setting vs. mapping 54
4.5.3 Grouping 56
4.5.4 Matching aesthetics to graphic objects 59
4.6 Geoms 62
4.7 Stat 62
4.8 Position adjustments 66
4.9 Pulling it all together 66
4.9.1 Combining geoms and stats 67
4.9.2 Displaying precomputed statistics 69
4.9.3 Varying aesthetics and data 69
5 Toolbox 72
5.1 Introduction 72
5.2 Overall layering strategy 73
5.3 Basic plot types 73
5.4 Displaying distributions 75
5.5 Dealing with overplotting 79
5.6 Surface plots 84
5.7 Drawing maps 84
5.8 Revealing uncertainty 87
5.9 Statistical summaries 88
5.9.1 Individual summary functions 91
5.9.2 Single summary function 91
5.10 Annotating a plot 92
5.11 Weighted data 95
6 Scales, axes and legends 98
6.1 Introduction 98
6.2 How scales work 99
6.3 Usage 100
6.4 Scale details 103
6.4.1 Common arguments 103
6.4.2 Position scales 105
6.4.3 Colour 109
6.4.4 The manual discrete scale 114
6.4.5 The identity scale 116
6.5 Legends and axes 117
6.6 More resources 119
7 Positioning 121
7.1 Introduction 121
7.2 Faceting 121
7.2.1 Facet grid 122
7.2.2 Facet wrap 126
7.2.3 Controlling scales 127
7.2.4 Missing faceting variables 129
7.2.5 Grouping vs. faceting 129
7.2.6 Dodging vs. faceting 131
7.2.7 Continuous variables 135
7.3 Coordinate systems 135
7.3.1 Transformation 136
7.3.2 Statistics 139
7.3.3 Cartesian coordinate systems 139
7.3.4 Non-Cartesian coordinate systems 142
8 Polishing your plots for publication 144
8.1 Themes 144
8.1.1 Built-in themes 145
8.1.2 Theme elements and element functions 147
8.2 Customising scales and geoms 152
8.2.1 Scales 152
8.2.2 Geoms and stats 153
8.3 Saving your output 153
8.4 Multiple plots on the same page 156
8.4.1 Subplots 157
8.4.2 Rectangular grids 158
9 Manipulating data 161
9.1 An introduction to plyr 161
9.1.1 Fitting multiple models 165
9.2 Converting data from wide to long 168
9.2.1 Multiple time series 168
9.2.2 Parallel coordinates plot 171
9.3 !ggplot()! methods 173
9.3.1 Linear models 174
9.3.2 Writing your own 177
10 Reducing duplication 180
10.1 Introduction 180
10.2 Iteration 180
10.3 Plot templates 181
10.4 Plot functions 184
Appendices 186
A Translating between different syntaxes 187
A.1 Introduction 187
A.2 Translating between qplot and ggplot 187
A.2.1 Aesthetics 187
A.2.2 Layers 188
A.2.3 Scales and axes 188
A.2.4 Plot options 189
A.3 Base graphics 189
A.3.1 High-level plotting commands 189
A.3.2 Low-level drawing 191
A.3.3 Legends, axes and grid lines 192
A.3.4 Colour palettes 192
A.3.5 Graphical parameters 192
A.4 Lattice graphics 192
A.5 GPL 194
B Aesthetic specifications 196
B.1 Colour 196
B.2 Line type 196
B.3 Shape 197
B.4 Size 197
B.5 Justification 197
C Manipulating plot rendering with !grid! 199
C.1 Introduction 199
C.2 Plot viewports 199
C.3 Plot grobs 201
C.4 Saving your work 201
References 203
Index 206
Code index 206

Erscheint lt. Verlag 3.10.2009
Reihe/Serie Use R!
Use R!
Zusatzinfo VIII, 213 p.
Verlagsort New York
Sprache englisch
Themenwelt Informatik Grafik / Design Digitale Bildverarbeitung
Mathematik / Informatik Informatik Software Entwicklung
Mathematik / Informatik Mathematik Computerprogramme / Computeralgebra
Mathematik / Informatik Mathematik Statistik
Mathematik / Informatik Mathematik Wahrscheinlichkeit / Kombinatorik
Technik
Schlagworte Data Analysis • Data graphics • dawatt • Grammar of Graphics • R • Statistical Graphics • Visualization
ISBN-10 0-387-98141-1 / 0387981411
ISBN-13 978-0-387-98141-3 / 9780387981413
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 9,1 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Explore powerful modeling and character creation techniques used for …

von Lukas Kutschera

eBook Download (2024)
Packt Publishing (Verlag)
43,19
Discover the smart way to polish your digital imagery skills by …

von Gary Bradley

eBook Download (2024)
Packt Publishing (Verlag)
45,59
Generate creative images from text prompts and seamlessly integrate …

von Margarida Barreto

eBook Download (2024)
Packt Publishing (Verlag)
32,39