PlotClusters(Data,IDX,Centers,Colors)
This function takes clustering data and plots it, if the data is 2d or 3d. The inputs are:
An m-by-d matrix of data points, where d is the number of dimension and m the number of data points
An m-by-1 vector of indices that associate each data point with a cluster.
Optional inputs:
A c-by-d matrix with c cluster centers. If not given, the function calculates them.
A c-by-3 matrix of colors, as generated by the hsv command. The number of colors has to be no less than the number of clusters
Uses: plot/plot3
Note: this was only tested with version 2008a on Windows. Should work for all versions.
Cite As
Elad Kivelevitch (2026). PlotClusters(Data,IDX,Centers,Colors) (https://uk.mathworks.com/matlabcentral/fileexchange/31710-plotclusters-data-idx-centers-colors), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- AI and Statistics > Statistics and Machine Learning Toolbox > Cluster Analysis and Anomaly Detection >
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 2.0.2.0 | . |
||
| 2.0.1.0 | Smaller number of point in the example to show centers |
||
| 2.0.0.0 | Version 2 includes two main improvements:
|
||
| 1.0.0.0 |
