plot.factor             package:graphics             R Documentation

Plotting Factor Variables

Description:

     This functions implements a "scatterplot" method for 'factor'
     arguments of the _generic_ 'plot' function. Actually, 'boxplot' or
     'barplot' are used when appropriate.

Usage:

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

Arguments:

     x,y: numeric or factor.  'y' may be missing.

legend.text: a vector of text used to construct a legend for the plot.
          Only used if 'y' is present and a factor.

     ...: Further arguments to 'plot', see also 'par'.

See Also:

     'plot.default', 'plot.formula', 'barplot', 'boxplot'.

Examples:

     data(PlantGrowth)
     plot(PlantGrowth)                                # -> plot.data.frame
     plot(weight ~ group, data = PlantGrowth)         # numeric vector ~ factor
     plot(cut(weight, 2) ~ group, data = PlantGrowth) # factor ~ factor
     ## passing "..." to barplot() eventually:
     plot(cut(weight, 3) ~ group, data = PlantGrowth, density = 16*(1:3),col=NULL)

     plot(PlantGrowth$group, axes=FALSE, main="no axes")# extremly silly

