This chapter provides a step-by-step introduction to creating graphs using qplot
(a graphics tool within the ggplot2
package), and gives examples of functioning qplot
code that can be adapted for many applications. The topics covered in this chapter are as follows:
Loading the
ggplot2
package in order to useqplot
Using basic
qplot
graphics techniques and syntaxCreating scatterplots and line graphs
Mapping symbol size, type, and color to categorical data
Including regressions and confidence intervals in your graphs
Creating bar charts, histograms, boxplots, pie charts, and dotcharts
Creating time series graphs with dates
It is not possible to give a complete account of qplot
in this book. However, by the end of this chapter, you should be able to use qplot
to create a wide range of graphs for research and analysis.