otplot: Visualize a partition on 2 dimensional space

View source: R/otplot.R

otplotR Documentation

Visualize a partition on 2 dimensional space

Description

This function plots a partition on 2 dimensional reduced space.

Usage

otplot(
  data,
  labels,
  convex.hull = F,
  title = "",
  xlab = "",
  ylab = "",
  legend.title = "",
  legend.labels = NULL,
  add.text = T
)

Arguments

data

– coordinates matrix of data.

labels

– cluster labels in a vector, the first cluster is labeled as 1.

convex.hull

– logical. If it is True, the plot draws convex hull for each cluster.

title

– title

xlab

– xlab

ylab

– ylab

legend.title

– legend title

legend.labels

– legend labels

add.text

– default True

Value

none

Examples

data(sim1)
# the number of clusters.
C = 4
ens.data = ensemble(sim1$X[1:50,], nbs=50, clust_param=C, clustering="kmeans", perturb_method=1)

# find mean partition and uncertainty statistics.
ota = otclust(ens.data)
# calculate baseline method for comparison.
kcl = kmeans(sim1$X[1:50],C)

# align clustering results for convenience of comparison.
compar = align(cbind(sim1$z[1:50],kcl$cluster,ota$meanpart))
lab.match = lapply(compar$weight,function(x) apply(x,2,which.max))
kcl.algnd = match(kcl$cluster,lab.match[[1]])
ota.algnd = match(ota$meanpart,lab.match[[2]])
# plot the result on two dimensional space.
otplot(sim1$X[1:50,],ota.algnd,con=FALSE,title='Mean partition')   # mean partition by OTclust

OTclust documentation built on Oct. 6, 2023, 5:09 p.m.