Learn R Programming

pdfCluster (version 1.0-4)

plot,pdfCluster-method: Plot objects of class pdfCluster

Description

Functions and methods for plotting objects of pdfCluster-class.

Usage

# S4 method for pdfCluster
plot(x, y, which = 1:4, stage = Inf, pch = NULL, col = NULL, ...)

Arguments

x

An object of pdfCluster-class;

y

Not used; for compatibility with generic plot;

which

To be used to select the type of plot:

  • when which = 1 plots the mode function, corresponding to the number of modes for different proportions of data points with density above a threshold.

  • when which = 2 plots the cluster tree associated to different sections of the density estimate.

  • when which = 3 displays the scatterplot of data or of all the possible pairs of coordinates reporting the label group.

  • when which = 4 the plot.dbs is displayed.

Multiple choices are possible.

stage

Plots the data points at the indicated stage of the classification procedure. Unallocated data are indicated by 0s. This argument applies if which=3 only.

pch

Either an integer specifying a symbol or a single character to be used in plotting points. If a vector of the same length as the number of groups is given, different symbols or characters are used for different groups. The default value denotes points as their group label. This argument applies if which=3 only.

col

Colors to be used in plotting points. If a vector of the same length as the number of groups is given, different colors or characters are used for different groups. The default value use colors in palette corresponding to the the group labels of the data. This argument applies if which=3 only.

...

Further arguments to be passed to plot-methods.

Methods

signature(x = "pdfCluster", y = "missing")

S4 method for plotting objects of pdfCluster-class

References

Azzalini A., Torelli N. (2007). Clustering via nonparametric density estimation. Statistics and Computing. vol. 17, pp. 71-80.

See Also

pdfCluster-class, plot, plot-methods.

Examples

Run this code
data(wine)
gr <- wine[,1]

# select a subset of variables
x <- wine[, c(2,5,8)]

#clustering
cl <- pdfCluster(x)
plot(cl, which=3, stage=2)

table(cl@clusters, gr)
#set "B" for Barolo, "G" for Grignolino, "A" for Barbera
plot(cl,  pch=c("B", "G", "A"), col=c(3,4,5))

Run the code above in your browser using DataLab