% % Copyright (c) 2015, Yarpiz (www.yarpiz.com) % All rights reserved. Please read the "license.txt" for license terms. % % Project Code: YPML110 % Project Title: Implementation of DBSCAN Clustering in MATLAB % Publisher: Yarpiz (www.yarpiz.com) % % Developer: S. Mostapha Kalami Heris (Member of Yarpiz Team) % % Contact Info: sm.kalami@gmail.com, info@yarpiz.com % function PlotClusterinResult(X, IDX) k=max(IDX); Colors=hsv(k); StyleChoices{1}='x'; StyleChoices{2}='h'; StyleChoices{3}='^'; StyleChoices{4}='+'; StyleChoices{5}='d'; Legends = {}; for i=0:k Xi=X(IDX==i,:); if i~=0 temp=mod(i,5)+1; Style = StyleChoices{temp}; MarkerSize = 8; Color = Colors(i,:); Legends{end+1} = ['Cluster #' num2str(i)]; else Style = 'o'; MarkerSize = 6; Color = [0 0 0]; if ~isempty(Xi) Legends{end+1} = 'Noise'; end end if ~isempty(Xi) plot(Xi(:,1),Xi(:,2),Style,'MarkerSize',MarkerSize,'Color',Color); end hold on; end hold off; axis equal; grid on; legend(Legends); legend('Location', 'NorthEastOutside'); end