plot_cluster: Convenience function to create a cluster plot using either...

Description Usage Arguments Examples

View source: R/plot.R

Description

This function creates a cluster plot of the cluster data point on the first two axes of a principal component analysis. An ellipsoid-hull is fitted round each cluster.

Usage

1
2
3
  plot_cluster(data, model, xLabel = "Component 1", yLabel
  = "Component 2", pca_function = princomp,
  ellipse_quantile = 1, segment_names = NULL)

Arguments

data

a data frame to be used in clustering

model

a cluster model of class kmeans or Mclust

xLabel

x-axis label

yLabel

y-axis label

pca_function

The method for calculating principal components. Must be either princomp or prcomp

ellipse_quantile

The quantile for plotting ellipsoids around clusters. For a value of 1, the ellipsoid will be an ellipsoid-hull, i.e. all points will be included.

segment_names

Character vector with cluster names

Examples

1
2
3
4
5
6
7
8
9
data(iris)
iris <- iris[, -5]

# Using kmeans for the clustering
plot_cluster(iris, kmeans(iris, 3))

# Using Mclust for the clustering
require(mclust)
plot_cluster(iris, Mclust(iris, 3))

pentalibra/ggcluster documentation built on May 25, 2019, 12:46 a.m.