High level commands and plotting functions in R set up a co-ordinate system. No plotting is done inside a graphics device until at least one high level function has established the co-ordinate system. High level commands include plot type and plot elements. Together, they provide users with direct control of all graph objects and support the creation of highly customized data visualizations.

*Plot Types in R*

*Plot Types in R*

One group of high level function defines the chart type († indicates alternative functions are used in Trellis charts):

Function | Description |
---|---|

barplot() † | Vertical or horizontal bar graph. |

boxes() | Boxplots at specified locations. |

boxplot() | Simple or side-by-side box plots. |

contour() † | Line chart given x, y, and z co-ordinates (e.g. terrain lines). The Trellis equivalent is contourplot(). |

dotchart() † | Plots a dot chart from a vector. |

hist() | A histogram. |

image() † | Heat map plot given x, y, and z co-ordinates (e.g. terrain area). The Trellis equivalent is levelplot() |

matplot() | Plots columns of one matrix against columns of another matrix. |

pairs() † | Pair-wise scatter plot of matrix columns. The Trellis equivalent is splom(). |

persp() † | Perspective plot given a heights matrix on a spaced grid (e.g. terrain). Trellis equivalent is wireframe(). |

pie() † | A pie chart. |

plot() | Generic function. Default method is an XY scatter plot. Produces special plot(s) for a given class . Method functions can be written to handle specific classes of data. Usage: plot(x, y, type,..) where types are define by: "p" for points, "l" for lines, "b" for both, "c" for the lines part alone of "b", "o" for both ‘overplotted’, "h" for ‘histogram’ "s" for stair steps, "S" for other steps, see R help "n" for no plotting. |

plot.default() | A scatter plot. |

qqnorm() | Same as above, but the quantile-quantile comparison is a given sample vs. the normal distribution. |

qqplot() | Generic function. Produces a graphical display to test the distribution of data based on quantile-quantile comparisons. Method functions can be written to handle specific classes of data. |

scatter() | A scatter plot. |

stars() | Star plots of a matrix of multivariate data. |

ts.plot() | Plots one or more time series. By default, five line types and four collars are cycled through. |

xyplot() | Trellis scatter plots. |

*High Level Commands and Plot Elements in R*

*High Level Commands and Plot Elements in R*

Other high level plotting functions add elements to the current plot, allowing the user direct control of graphic objects. These functions are called after and outside of the plot type commands. Plot elements, because they are high level commands, are capable of launching a graphics device. See help() for detailed arguments:

Function | Description |
---|---|

abline() | Add lines to the current plot; horizontal, vertical, or slope-intercept form |

arrows() | Draw arrows between pairs of points. |

axis() | Add a custom axis to the plot |

box() | Surround the current plot with a box. |

identify() | Read the position of the graphics pointer when the (first) mouse button is pressed. Returns and index with x/y coordinates. |

lines() | Add lines to the plot. |

locator() | Returns co-ordinates specified interactively on a plot so points/lines can be added |

mtext() | Add text in the margins. |

par() | Set graphics parameters; controls the actions of the graphic device. |

points() | Add points to the plot |

polygon() | Add polygon(s) to the plot. |

rect() | Add a rectangle to the plot. |

segments() | Draw line segments between pairs of points. |

symbols() | Add symbols to the plot. |

text() | Add text to the plot |

title() | Add labels to the plot. Use with expression() for math symbols. |