An Overview of R Graphics
R includes tools for drawing most common types of charts, including
bar charts, pie charts, line charts, and scatter plots. Additionally, R
can also draw some less-familiar charts like quantile-quantile (Q-Q)
plots, mosaic plots, and contour plots. The following table shows many of
the charts included in the graphics
package.
Graphics package function | Description |
---|---|
barplot | Bar and column charts |
dotchart | Cleveland dot plots |
hist | Histograms |
density | Kernel density plots |
stripchart | Strip charts |
qqnorm (in stats package) | Quantile-quantile plots |
xplot | Scatter plots |
smoothScatter | Smooth scatter plots |
qqplot (in stats package) | Quantile-quantile plots |
pairs | Scatter plot matrices |
image | Image plots |
contour | Contour plots |
persp | Perspective charts of three-dimensional data |
interaction.plot | Summary of the response for two-way combinations of factors |
sunflowerplot | Sunflower plots |
You can show R graphics on the screen or save them in many different formats. Graphics Devices explains how to choose output methods. R gives you an enormous amount of control over graphics. You can control almost every aspect of a chart. Customizing Charts explains how to tweak the output of R to look the way you want. This section shows how to use many common types of R charts.
Scatter Plots
To show how to use scatter plots, we will look at cases of cancer in 2008 and toxic waste releases by state in 2006. Data on new cancer cases (and deaths from cancer) are tabulated by the American Cancer Society; information on toxic chemicals ...
Get R in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.