| 27442 |
ripley |
1 |
\name{plot.formula}
|
|
|
2 |
\alias{plot.formula}
|
|
|
3 |
\alias{lines.formula}
|
|
|
4 |
\alias{points.formula}
|
|
|
5 |
\title{Formula Notation for Scatterplots}
|
|
|
6 |
\description{
|
|
|
7 |
Specify a scatterplot or add points or lines via a formula.
|
|
|
8 |
}
|
|
|
9 |
\usage{
|
|
|
10 |
\method{plot}{formula}(formula, data = parent.frame(), \dots, subset,
|
|
|
11 |
ylab = varnames[response], ask = TRUE)
|
|
|
12 |
|
|
|
13 |
\method{points}{formula}(formula, data = parent.frame(), \dots, subset)
|
|
|
14 |
|
|
|
15 |
\method{lines}{formula}(formula, data = parent.frame(), \dots, subset)
|
|
|
16 |
}
|
|
|
17 |
\arguments{
|
| 27447 |
ripley |
18 |
\item{formula}{a \code{\link[stats]{formula}}, such as \code{y ~ x}.}
|
| 27442 |
ripley |
19 |
\item{data}{a data.frame (or list) from which the variables in
|
|
|
20 |
\code{formula} should be taken.}
|
|
|
21 |
\item{\dots}{Further graphical parameters may also be passed as
|
|
|
22 |
arguments, see \code{\link{par}}. \code{horizontal = TRUE}
|
|
|
23 |
is also accepted.}
|
|
|
24 |
\item{subset}{an optional vector specifying a subset of observations
|
|
|
25 |
to be used in the fitting process.}
|
|
|
26 |
\item{ylab}{the y label of the plot(s).}
|
|
|
27 |
\item{ask}{logical, see \code{\link{par}}.}
|
|
|
28 |
}
|
|
|
29 |
\details{
|
|
|
30 |
Both the terms in the formula and the \code{\dots} arguments are
|
|
|
31 |
evaluated in \code{data} enclosed in \code{parent.frame()} if
|
|
|
32 |
\code{data} is a list or a data frame. The terms of the formula and
|
|
|
33 |
those arguments in \code{\dots} that are of the same length as
|
|
|
34 |
\code{data} are subjected to the subsetting specified in
|
|
|
35 |
\code{subset}. If the formula in \code{plot.formula} contains more
|
|
|
36 |
than one non-response term, a series of plots of y against each term
|
|
|
37 |
is given. A plot against the running index can be specified as
|
|
|
38 |
\code{plot(y~1)}.
|
|
|
39 |
|
|
|
40 |
If \code{y} is an object (ie. has a \code{\link[base]{class}} attribute)
|
|
|
41 |
then \code{plot.formula} looks for a plot method for that class first.
|
|
|
42 |
Otherwise, the class of \code{x} will determine the type of the plot.
|
|
|
43 |
For factors this will be a parallel boxplot, and argument
|
|
|
44 |
\code{horizontal = TRUE} can be used (see \code{\link{boxplot}}).
|
|
|
45 |
}
|
|
|
46 |
\value{
|
|
|
47 |
These functions are invoked for their side effect of drawing
|
|
|
48 |
in the active graphics device.
|
|
|
49 |
}
|
|
|
50 |
\seealso{
|
|
|
51 |
\code{\link{plot.default}}, \code{\link{plot.factor}}.
|
|
|
52 |
}
|
|
|
53 |
\examples{
|
|
|
54 |
data(airquality)
|
|
|
55 |
op <- par(mfrow=c(2,1))
|
|
|
56 |
plot(Ozone ~ Wind, data = airquality, pch=as.character(Month))
|
|
|
57 |
plot(Ozone ~ Wind, data = airquality, pch=as.character(Month),
|
|
|
58 |
subset = Month != 7)
|
|
|
59 |
par(op)
|
|
|
60 |
}
|
|
|
61 |
\keyword{hplot}
|