|
1 | 1 | % File src/library/graphics/man/plotfactor.Rd |
2 | 2 | % Part of the R package, https://www.R-project.org |
3 | | -% Copyright 1995-2009 R Core Team |
| 3 | +% Copyright 1995-2024 R Core Team |
4 | 4 | % Distributed under GPL 2 or later |
5 | 5 |
|
6 | 6 | \name{plot.factor} |
| 7 | +\alias{plot.factor} |
7 | 8 | \title{Plotting Factor Variables} |
8 | 9 | \usage{ |
9 | | -\method{plot}{factor}(x, y, legend.text = NULL, \dots) |
| 10 | +\method{plot}{factor}(x, y, legend.text = NULL, ...) |
10 | 11 | } |
11 | | -\alias{plot.factor} |
12 | 12 | \arguments{ |
13 | 13 | \item{x, y}{numeric or factor. \code{y} may be missing.} |
14 | 14 | \item{legend.text}{character vector for annotation of y axis in the |
|
17 | 17 | \item{\dots}{Further arguments to \code{\link{barplot}}, |
18 | 18 | \code{\link{boxplot}}, \code{\link{spineplot}} or |
19 | 19 | \code{\link{plot}} as appropriate. All of these accept |
20 | | - \link{graphical parameters} (see \code{\link{par}}) and |
| 20 | + \link{graphical parameters} (see \code{\link{par}}), |
21 | 21 | annotation arguments passed |
22 | | - to \code{\link{title}} and \code{axes = FALSE}. None accept \code{type}. |
| 22 | + to \code{\link{title}}, and \code{axes = FALSE}. None accept \code{type}. |
23 | 23 | } |
24 | 24 | } |
25 | 25 | \description{ |
26 | 26 | This method is used for |
27 | 27 | \code{\link{factor}} arguments of the \emph{generic} |
28 | 28 | \code{\link{plot}} function, |
29 | | - possibly called from the formula method (see the Examples). |
| 29 | + possibly called from the formula method. |
30 | 30 |
|
31 | | - If \code{y} is missing \code{\link{barplot}} is produced. |
| 31 | + If \code{y} is missing a \code{\link{barplot}} is produced. |
32 | 32 | For numeric \code{y} a \code{\link{boxplot}} is used, and for a factor |
33 | 33 | \code{y} a \code{\link{spineplot}} is shown. For any other type of |
34 | 34 | \code{y} the next \code{plot} method is called, normally |
|
40 | 40 | } |
41 | 41 | \examples{ |
42 | 42 | require(grDevices) |
43 | | -% this does not call plot.factor! |
44 | | -% plot(PlantGrowth) # -> plot.data.frame |
45 | | -plot(weight ~ group, data = PlantGrowth) # numeric vector ~ factor |
| 43 | + |
| 44 | +plot(state.region) |
| 45 | + |
| 46 | +## called from the formula method |
| 47 | +plot(~ group, data = PlantGrowth) |
| 48 | +plot(weight ~ group, data = PlantGrowth) # numeric ~ factor |
46 | 49 | plot(cut(weight, 2) ~ group, data = PlantGrowth) # factor ~ factor |
47 | 50 | ## passing "..." to spineplot() eventually: |
48 | 51 | plot(cut(weight, 3) ~ group, data = PlantGrowth, |
|
0 commit comments