2-dimensional plots
plot_2d(data, clusters, centroids_medoids)
a 2-dimensional matrix or data frame
numeric vector of length equal to the number of rows of the data, which is the result of a clustering method
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.
a plot
This function plots the clusters using 2-dimensional data and medoids or centroids.
# 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)