This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Class: clustering.evaluation.ClusterCriterion
Package: clustering.evaluation

Plot clustering evaluation object criterion values


h = plot(eva)


plot(eva) displays a plot of the criterion values versus the number of clusters, based on the values stored in the clustering evaluation object eva.

h = plot(eva) returns a handle to the plot line.

Input Arguments

expand all

Clustering evaluation data, specified as a clustering evaluation object. Create a clustering evaluation object using evalclusters.

Output Arguments

expand all

Handle to the plot line, returned as a scalar value.


expand all

Plot the criterion values versus the number of clusters for each clustering solution stored in a clustering evaluation object.

Load the sample data.

load fisheriris

The data contains length and width measurements from the sepals and petals of three species of iris flowers.

Create a clustering evaluation object. Cluster the data using kmeans, and evaluate the optimal number of clusters using the Calinski-Harabasz criterion.

rng('default');  % For reproducibility
eva = evalclusters(meas,'kmeans','CalinskiHarabasz','KList',[1:6]);

Plot the Calinski-Harabasz criterion values for each number of clusters tested.


The plot shows that the highest Calinski-Harabasz value occurs at three clusters, suggesting that the optimal number of clusters is three.

See Also