plotCluster: Plotting of a class ['MixmodResults']

View source: R/MixmodResults.R

plotClusterR Documentation

Plotting of a class [MixmodResults]

Description

Biplot of two variables from a quantitative data set. Use parameters and partition from a [MixmodResults] object to distinguish the different clusters.

Usage

plotCluster(
  x,
  data,
  variable1 = colnames(data)[1],
  variable2 = colnames(data)[2],
  col = x@partition + 1,
  pch = x@partition,
  xlab = variable1,
  ylab = variable2,
  add.ellipse = TRUE,
  ...
)

Arguments

x

an object of class [MixmodResults]

data

a data frame containing a quantitative data set.

variable1

index or character containing the name of the first variable. First column of data by default.

variable2

index or character containing the name of the second variable. Second column of data by default.

col

a specification for the default plotting color. By default partition is used to separate clusters with different colors.

pch

either an integer specifying a symbol or a single character to be used as the default in plotting points. By default partition is used to separate clusters with different symbols.

xlab

a title for the x axis. Variable1 by default.

ylab

a title for the y axis. Variable2 by default.

add.ellipse

a boolean. Add ellipses to graph. TRUE by default.

...

further arguments passed to or from other methods

Details

Ellipsoids (i.e. linear transformations of hyperspheres) centered at the mean can be drawn using the parameters computed by MIXMOD. The directions of the principal axes of the ellipsoids are given by the eigenvectors of the covariance matrix \Sigma. The squared relative lengths of the principal axes are given by the corresponding eigenvalues.

See Also

plot

Examples

data(geyser)
xem1 <- mixmodCluster(geyser, 3)
plotCluster(xem1["bestResult"], geyser)

data(iris)
xem2 <- mixmodCluster(iris[1:4], 2:6)
plotCluster(xem2["bestResult"], iris, variable1 = "Sepal.Length", variable2 = "Sepal.Width")
plotCluster(xem2["bestResult"], iris, variable1 = 1, variable2 = 4)

Rmixmod documentation built on May 29, 2024, 7:32 a.m.