Previous: Graphing Commands Up: Graphing Commands Next: Adding Points, Lines, and


Drawing Plots

The most generic plotting command is plot(), which automatically recognizes the type of R object(s) you are trying to plot and selects the best type of plot. The most common graphs returned by plot() are as follows:

  1. If X is a variable of length 2#2 , plot(X) returns a scatter plot of 27#27 for 28#28 . If X is unsorted, this procedure produces a messy graph. Use plot(sort(X)) to arrange the plotted values of 27#27 from smallest to largest.
  2. With two numeric vectors X and Y, both of length 2#2 , plot(X, Y) plots a scatter plot of each point 29#29 for 28#28 . Alternatively, if Z is an object with two vectors, plot(Z) also creates a scatter plot.

Optional arguments specific to plot include:

For additional plotting options, refer to help(par).



Gary King 2011-11-29