Chapter 3. Mastering the qplot Function

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 use qplot
  • Using basic qplot graphics techniques and syntax
  • Creating 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.

About qplot

The qplot (quick plot) system is a subset of the ggplot2 (grammar of graphics) package, which you can use to create nice graphs easily. To use qplot, first install ggplot2 . On the R command line, enter the following command:

install.packages("ggplot2")

Then load ggplot2 using this command:

library(ggplot2)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset