R_Graph_Cookbook
目录
Preface 1
Chapter 1: Basic Graph Functions 7
Introduction 7
Creating scatter plots 8
Creating line graphs 12
Creating bar charts 14
Creating histograms and density plots 17
Creating box plots 20
Adjusting X and Y axes limits 22
Creating heat maps 24
Creating pairs plots 27
Creating multiple plot matrix layouts 30
Adding and formatting legends 33
Creating graphs with maps 37
Saving and exporting graphs 40
Chapter 2: Beyond the Basics: Adjusting Key Parameters 43
Introduction 43
Setting colors of points, lines, and bars 44
Setting plot background colors 48
Setting colors for text elements: axis annotations, labels, plot titles,
and legends 50
Choosing color combinations and palettes 52
Setting fonts for annotations and titles 54
Choosing plotting point symbol styles and sizes 56
Choosing line styles and width 58
Choosing box styles 60
Adjusting axis annotations and tick marks 63
Formatting log axes 65
Setting graph margins and dimensions 66
ii
Table of Contents
Chapter 3: Creating Scatter Plots 69
Introduction 69
Grouping data points within a scatter plot 70
Highlighting grouped data points by size and symbol type 73
Labelling data points 75
Correlation matrix using pairs plot 78
Adding error bars 79
Using jitter to distinguish closely packed data points 82
Adding linear model lines 84
Adding non-linear model curves 85
Adding non-parametric model curves with lowess 86
Making three-dimensional scatter plots 87
How to make Quantile-Quantile plots 89
Displaying data density on axes 91
Making scatter plots with smoothed density representation 93
Chapter 4: Creating Line Graphs and Time Series Charts 95
Introduction 96
Adding customized legends for multiple line graphs 96
Using margin labels instead of legends for multiple line graphs 99
Adding horizontal and vertical grid lines 101
Adding marker lines at specific X and Y values 104
Creating sparklines 105
Plotting functions of a variable in a dataset 107
Formatting time series data for plotting 109
Plotting date and time on the X axis 111
Annotating axis labels in different human readable time formats 113
Adding vertical markers to indicate specific time events 115
Plotting data with varying time averaging periods 117
Creating stock charts 118
Chapter 5: Creating Bar, Dot, and Pie Charts 123
Introduction 123
Creating bar charts with more than one factor variable 124
Creating stacked bar charts 126
Adjusting the orientation of bars—horizontal and vertical 128
Adjusting bar widths, spacing, colors, and borders 130
Displaying values on top of or next to the bars 132
Placing labels inside bars 134
Creating bar charts with vertical error bars 135
Modifying dot charts by grouping variables 137
iii
Table of Contents
Making better readable pie charts with clockwise-ordered slices 139
Labelling a pie chart with percentage values for each slice 141
Adding a legend to a pie chart 143
Chapter 6: Creating Histograms 145
Introduction 145
Visualizing distributions as count frequencies or probability densities 146
Setting bin size and number of breaks 148
Adjusting histogram styles: bar colors, borders, and axes 150
Overlaying density line over a histogram 152
Multiple histograms along the diagonal of a pairs plot 153
Histograms in the margins of line and scatter plots 155
Chapter 7: Creating Box and Whisker Plots 159
Introduction 159
Creating box plots with narrow boxes for a small number of variables 160
Grouping over a variable 162
Varying box widths by number of observations 164
Creating box plots with notches 165
Including or excluding outliers 166
Creating horizontal box plots 167
Changing box styling 169
Adjusting the extent of plot whiskers outside the box 170
Showing the number of observations 172
Splitting a variable at arbitrary values into subsets 175
Chapter 8: Creating Heat Maps and Contour Plots 181
Introduction 181
Creating heat maps of single Z variable with scale 182
Creating correlation heat maps 185
Summarizing multivariate data in a heat map 187
Creating contour plots 192
Creating filled contour plots 194
Creating three-dimensional surface plots 197
Visualizing time series as calendar heat maps 199
Chapter 9: Creating Maps 205
Introduction 205
Plotting global data by countries on a world map 206
Creating graphs with regional maps 210
Plotting data on Google maps 215
Creating and reading KML data 219
Working with ESRI shapefiles 220
下载:
R_Graph_Cookbook.rar
(3.42 MB, 下载次数: 9, 售价: 5 )
备注:
很多人都有收集一堆资料而不看的习惯。为了有效利用资源,养成下载一本看一本的习惯,特设置了积分下载,请见谅。
多参加论坛的活动、多帮助别人,会很容易凑够积分的!
祝大家使用愉快!
|