plot.factor {graphics}R Documentation

Plotting Factor Variables

Description

This functions implements a “scatterplot” method for factor arguments of the generic plot function. Actually, boxplot is used when y is numeric and a spineplot when y is a factor. For a single factor x (i.e., with y missing) a simple barplot is produced.

Usage

## S3 method for class 'factor':
plot(x, y, legend.text = NULL, ...)

Arguments

x, y numeric or factor. y may be missing.
legend.text character vector for annotation of y axis, defaults to levels(y). Can be used instead of yaxlabels (for backward compatibility).
... Further arguments to plot, see also par.

See Also

plot.default, plot.formula, barplot, boxplot, spineplot.

Examples

plot(PlantGrowth)                                # -> plot.data.frame
plot(weight ~ group, data = PlantGrowth)         # numeric vector ~ 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")# extremly silly

[Package graphics version 2.2.1 Index]