csci5451/assignments/04/plot_clusters2D.m
2023-12-10 15:40:31 -06:00

23 lines
475 B
Matlab

function plot_clusters2D(points_file, clusters_file, centroids_file)
X = load(points_file);
X(1,:) = []; % remove metadata
clusters = load(clusters_file);
centroids = load(centroids_file);
centroids(1,:) = []; % remove metadata
f = figure();
hold on
nclusters = size(centroids,1);
for c=1:nclusters
points = X(clusters == c-1, :);
scatter(points(:,1), points(:,2));
scatter(centroids(c,1), centroids(c,2), '+k', 'LineWidth', 5, 'SizeData', 100);
end
uiwait(f);