text()function allows us to put text on the plot where we want it. An obvious use is to label a line or group of points.
This would give us two labels in the upper right corner of the plot, which with appropriate arrows could be used in place of a legend. Note that vectors were supplied as the coordinates. The first label would be centered at (2,37), and the second at (2,35), as the default alignment is to center the labels.
Text labels can also be placed in the margins of a plot using the
This would place the words "Low" and "High" on the second line below the X axis
centered at 5 and 7 units. Note that the documentation declares that "user
mtext() do not match those on the plot, but it
appears that they do at the moment (R-1.6.2).
For more information, see An Introduction to R: Low-level plotting commands.
Back to Table of Contents