plot_2d {ClusterR}R Documentation

2-dimensional plots

Description

2-dimensional plots

Usage

plot_2d(data, clusters, centroids_medoids)

Arguments

data

a 2-dimensional matrix or data frame

clusters

numeric vector of length equal to the number of rows of the data, which is the result of a clustering method

centroids_medoids

a matrix of centroids or medoids. The rows of the centroids_medoids should be equal to the length of the unique values of the clusters and the columns should be equal to the columns of the data.

Details

This function plots the clusters using 2-dimensional data and medoids or centroids.

Value

a plot

Author(s)

Lampros Mouselimis

Examples


# data(dietary_survey_IBS)

# dat = dietary_survey_IBS[, -ncol(dietary_survey_IBS)]

# dat = center_scale(dat)

# pca_dat = stats::princomp(dat)$scores[, 1:2]

# km = KMeans_rcpp(pca_dat, clusters = 2, num_init = 5, max_iters = 100)

# plot_2d(pca_dat, km$clusters, km$centroids)


[Package ClusterR version 1.3.3 Index]