.BG
.VE $Header: /usr/s/current/s/.help/RCS/legend,v 1.4 87/03/04 10:58:35 rab Exp $
.FN legend
.TL
legend: Put a Legend on a Plot
.CS
legend(x, y, legend, angle, density, fill, col, lty, pch, ncol, background)
.PP
The function `legend' draws a box at specified coordinates and puts
inside examples of lines, points, shaded or filled rectangles,
each identified with a user-specified text string.
.AG x,y
coordinates of rectangular area to hold legend.
If `x' and `y' are vectors of length one,
they determine top left of rectangle.
If `x' and `y' are vectors of length two,
they determine two corners of the rectangle.
A structure containing components named "x" and "y" may also be supplied.
.AG legend
character vector giving text labels
to be associated with shading patterns, line
types, or plot characters.
.AG angle
optional vector giving the angle (degrees, counter-clockwise
from horizontal) for shading rectangular symbols.
Defaults to 45 if `density' is supplied.
.AG density
optional vector, used for rectangular symbols,
giving the number of lines per inch for shading
bar divisions.
Defaults to 5 if `angle' is given.
.AG fill
optional vector, fill color for filled rectangular symbols.
.AG col
optional vector, colors for text, lines, characters.
.AG lty
optional vector of line types.
.AG pch
optional character string of plotting characters.
Single characters from `pch' will be used.
.AG ncol
the number of columns into which the legend may be broken.
.AG background
the background color of the box containing the entire legend.
.GR
.SH SEE ALSO
`barplot' which contains a sample legend.
.EX
# use rdpen to point at lower-left and upper-right corners
# of area to contain the legend -- draw colored boxes
legend(rdpen(2),legend=c("IBM","AT&T","GM"),fill=2:4) 

# draw legend with different line styles and plotting chars
legend(c(0,5),c(5,10),names,lty=1:5,pch="O+*")
.KW plot*
.KW aplot*
.KW reports
.WR
