plot.factor {graphics} | R Documentation |
Plotting Factor Variables
Description
This method is used for
factor
arguments of the generic
plot
function,
possibly called from the formula method.
If y
is missing a barplot
is produced.
For numeric y
a boxplot
is used, and for a factor
y
a spineplot
is shown. For any other type of
y
the next plot
method is called, normally
plot.default
.
Usage
## S3 method for class 'factor'
plot(x, y, legend.text = NULL, ...)
Arguments
x , y |
numeric or factor. |
legend.text |
character vector for annotation of y axis in the
case of a factor |
... |
Further arguments to |
See Also
plot.default
, plot.formula
,
barplot
, boxplot
, spineplot
.
Examples
require(grDevices)
plot(state.region)
## called from the formula method
plot(~ group, data = PlantGrowth)
plot(weight ~ group, data = PlantGrowth) # numeric ~ factor
plot(cut(weight, 2) ~ group, data = PlantGrowth) # factor ~ factor
## passing "..." to spineplot() eventually:
plot(cut(weight, 3) ~ group, data = PlantGrowth,
col = hcl(c(0, 120, 240), 50, 70))
plot(PlantGrowth$group, axes = FALSE, main = "no axes") # extremely silly
[Package graphics version 4.5.0 Index]