a1_plotppcontour: Plot Contour

Plot Projection and ContourR Documentation

Plot Contour

Description

The function plots multivariate data on 2D plane with contour. Typically, the contour is built via projection pursuit or SVD algorithms, such as project.on.2d().

Usage

plotppcontour(da, Pi, Mu, S, class, class.true = NULL, n.grid = 128,
    angle = 0, xlab = "", ylab = "", main = "")

Arguments

da

a projected data matrix, dimension n\times 2.

Pi

proportion, length K.

Mu

the projected centers of cluster, dimension K\times 2.

S

projected matrices of dispersion, dimension p\times p \times K.

class

id of classifications, length n.

class.true

ture id of classifications if available, length n.

n.grid

number of grid points.

angle

a rotation angle (0 to 2\pi).

xlab

an option for plot() function.

ylab

an option for plot() function.

main

an option for plot() function.

Details

This function plots projection output of project.on.2d().

da, Mu, and S are projected by some projection matrices obtained via SVD or projection pursuit algorithms. The projection is made on a 2D plane in the direction in which clusters of data x are most distinguishable to visualize.

Value

A 2D projection plot is returned.

Note

Only distinguishable for up to 7 clusters due to the limited color schemes.

Author(s)

Wei-Chen Chen wccsnow@gmail.com and Ranjan Maitra.

References

https://www.stat.iastate.edu/people/ranjan-maitra

See Also

project.on.2d().

Examples

## Not run: 
library(EMCluster, quietly = TRUE)
library(MASS, quietly = TRUE)
set.seed(1234)

### Crabs.
x <- as.matrix(crabs[, 4:8])
ret <- init.EM(x, nclass = 4, min.n = 20)
ret.proj <- project.on.2d(x, ret)

### Plot.
pdf("crabs_ppcontour.pdf", height = 5, width = 5)
plotppcontour(ret.proj$da, ret.proj$Pi, ret.proj$Mu, ret.proj$S,
              ret.proj$class, angle = pi/6, main = "Crabs K = 4")
dev.off()

## End(Not run)

EMCluster documentation built on Sept. 11, 2024, 5:27 p.m.