| 27442 |
ripley |
1 |
\name{plot.factor}
|
|
|
2 |
\title{Plotting Factor Variables}
|
|
|
3 |
\usage{
|
| 35534 |
hornik |
4 |
\method{plot}{factor}(x, y, legend.text = NULL, \dots)
|
| 27442 |
ripley |
5 |
}
|
|
|
6 |
\alias{plot.factor}
|
|
|
7 |
\arguments{
|
| 35539 |
hornik |
8 |
\item{x, y}{numeric or factor. \code{y} may be missing.}
|
| 35534 |
hornik |
9 |
\item{legend.text}{character vector for annotation of y axis,
|
|
|
10 |
defaults to \code{levels(y)}. Can be used instead of \code{yaxlabels}
|
|
|
11 |
(for backward compatibility).}
|
| 27442 |
ripley |
12 |
\item{\dots}{Further arguments to \code{\link{plot}}, see also
|
|
|
13 |
\code{\link{par}}.}
|
|
|
14 |
}
|
|
|
15 |
\description{
|
|
|
16 |
This functions implements a \dQuote{scatterplot} method for
|
|
|
17 |
\code{\link{factor}} arguments of the \emph{generic}
|
|
|
18 |
\code{\link{plot}} function.
|
| 35539 |
hornik |
19 |
Actually, \code{\link{boxplot}} is used when \code{y} is numeric
|
|
|
20 |
and a \code{\link{spineplot}} when \code{y} is a factor. For
|
|
|
21 |
a single factor \code{x} (i.e., with \code{y} missing) a simple
|
|
|
22 |
\code{\link{barplot}} is produced.
|
| 27442 |
ripley |
23 |
}
|
|
|
24 |
\seealso{
|
|
|
25 |
\code{\link{plot.default}}, \code{\link{plot.formula}},
|
| 35539 |
hornik |
26 |
\code{\link{barplot}}, \code{\link{boxplot}}, \code{\link{spineplot}}.
|
| 27442 |
ripley |
27 |
}
|
|
|
28 |
\examples{
|
| 41502 |
ripley |
29 |
require(grDevices)
|
| 27442 |
ripley |
30 |
plot(PlantGrowth) # -> plot.data.frame
|
|
|
31 |
plot(weight ~ group, data = PlantGrowth) # numeric vector ~ factor
|
|
|
32 |
plot(cut(weight, 2) ~ group, data = PlantGrowth) # factor ~ factor
|
| 35534 |
hornik |
33 |
## passing "..." to spineplot() eventually:
|
| 36816 |
ripley |
34 |
plot(cut(weight, 3) ~ group, data = PlantGrowth,
|
|
|
35 |
col = hcl(c(0, 120, 240), 50, 70))
|
| 27442 |
ripley |
36 |
|
| 40284 |
ripley |
37 |
plot(PlantGrowth$group, axes=FALSE, main="no axes")# extremely silly
|
| 27442 |
ripley |
38 |
}
|
|
|
39 |
\keyword{hplot}
|