Learn R Programming

flexclust (version 1.4-1)

bwplot-methods: Box-Whisker Plot Methods in Package `flexclust'

Description

Seperate boxplot of variables in each cluster in comparison with boxplot for complete sample.

Usage

# S4 method for kcca
bwplot(x, data, xlab="",
       strip.labels=NULL, strip.prefix="Cluster ",
       col=NULL, shade=!is.null(shadefun), shadefun=NULL, byvar=FALSE, ...)
# S4 method for bclust
bwplot(x, k=x@k, xlab="", strip.labels=NULL, 
       strip.prefix="Cluster ", clusters=1:k, ...)

Arguments

x

An object of class "kcca" or "bclust".

data

If not NULL, cluster membership is predicted for the new data and used for the plots. By default the values from the training data are used.

xlab, …

Graphical parameters.

col

Vector of colors for the clusters.

strip.labels

Vector of strings for the strips of the Trellis display.

strip.prefix

Prefix string for the strips of the Trellis display.

shade

If TRUE, only boxes with larger deviation from the median or quartiles of the total population of the respective variables are filled with color.

shadefun

A function or name of a function to compute which boxes are shaded, e.g. "medianInside" (default) or "boxOverlap".

byvar

If TRUE, a panel is plotted for each variable. By default a panel is plotted for each group.

k

Number of clusters.

clusters

Integer vector of clusters to plot.

Examples

Run this code
# NOT RUN {
  set.seed(1)
  cl <- cclust(iris[,-5], k=3, save.data=TRUE)
  bwplot(cl)
  bwplot(cl, byvar=TRUE)

  ## fill only boxes with color which do not contain the overall median
  ## (grey dot of background box)
  bwplot(cl, shade=TRUE)

  ## fill only boxes with color which do not overlap with the box of the
  ## complete sample (grey background box)
  bwplot(cl, shadefun="boxOverlap")
# }

Run the code above in your browser using DataLab