Learn R Programming

CCMMR (version 0.2)

plot.cvxclust: Plot 2D clusterpath

Description

Plot a clusterpath for two-dimensional data.

Usage

# S3 method for cvxclust
plot(x, col = NULL, labels = NULL, ...)

Value

A plot in the console.

Arguments

x

A cvxclust object.

col

A vector containing cluster membership information. Default is NULL.

labels

A vector containing labels for each object. Default is NULL.

...

Further graphical parameters.

Examples

Run this code
# Load data
data(two_half_moons)
data = as.matrix(two_half_moons)
X = data[, -3]
y = data[, 3]

# Get sparse distances in dictionary of keys format with k = 5 and phi = 8
W = sparse_weights(X, 5, 8.0)

# Set a sequence for lambda
lambdas = seq(0, 2400, 1)

# Compute results CMM
res = convex_clusterpath(X, W, lambdas)
plot(res, y + 1)

Run the code above in your browser using DataLab