redraw.m % Redraw draws the points so that each cluster is a different color. % The hubs are represented by a + and the members are represented by a *. n = size(data,1); pointer = zeros(n, 1); for i=1:counter pointer(hubs(i))=i; % Pointer's indices are the data point indices % Pointer's cells are the hub numbers for the points end; hold off; % Color code the points based on the cluster number for i = 1:n x = data(i,1); y = data(i,2); if pointer(clusters(i)) == 1 if clusters(i) == i plot(x, y, 'y+'); else plot(x, y, 'y*'); end hold on; elseif pointer(clusters(i)) == 2 if clusters(i) == i plot(x, y, 'm+'); else plot(x, y, 'm*'); end hold on; elseif pointer(clusters(i)) == 3 if clusters(i) == i plot(x, y, 'c+'); else plot(x, y, 'c*'); end hold on elseif pointer(clusters(i)) == 4 if clusters(i) == i plot(x, y, 'r+'); else plot(x, y, 'r*'); end hold on elseif pointer(clusters(i)) == 5 if clusters(i) == i plot(x, y, 'g+'); else plot(x, y, 'g*'); end hold on elseif pointer(clusters(i)) == 6 if clusters(i) == i plot(x, y, 'b+'); else plot(x, y, 'b*'); end hold on else if clusters(i) == i plot(x, y, 'w+'); else plot(x, y, 'w*'); end hold on end end % Sets up the axes x = data(:,1); y = data(:,2); minx = min(x); maxx = max(x); miny = min(y); maxy = max(y); axis([minx-1, maxx+1, miny - 1, maxy + 1]);