plot.factor

Plotting Factor Variables

This functions implements a scatterplot method for factor arguments of the generic plot function.

If y is missing 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.

Keywords
hplot
Usage
# S3 method for 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 in the case of a factor y: defaults to levels(y). This sets the yaxlabels argument of spineplot.

Further arguments to barplot, boxplot, spineplot or plot as appropriate. All of these accept graphical parameters (see par) and annotation arguments passed to title and axes = FALSE. None accept type.

See Also

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

Aliases
  • plot.factor
Examples
library(graphics) require(grDevices) <!-- % this does not call plot.factor! --> <!-- % 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") # extremely silly
Documentation reproduced from package graphics, version 3.4.0, License: Part of R 3.4.0

Community examples

Looks like there are no examples yet.