forked from scheidtc/Distance-Based-Model-Selection
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathplotcmdmap.m
More file actions
49 lines (34 loc) · 1.4 KB
/
Copy pathplotcmdmap.m
File metadata and controls
49 lines (34 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function plotcmdmap(Xd,KKM)
%% Function which maps the points defined in MDS (Xd) and (optional) colors the
%% points according to the clustering results obtained by kernel_kmedoid.m
% Author: Celine Scheidt
% Date: April 2009
%% Input Parameters:
% - Xd: location of the points to be plotted (from MDS). Rows of Xd are the coordinates in p-dimensional space
% - KKM: results from the clustering in the format given by the function kkmedoid. This is optional.
% If given, point are colored by clusters; medoids are represented by squares
if nargin ==2
% definition of the color of each cluster
C = jet;
C = C(floor(linspace(1,size(C,1),max(KKM.label))),:);
figure
for i=1:length(KKM.medoids)
plot(Xd(KKM.label==i,1), Xd(KKM.label==i,2), 'o', 'Color',C(i,:), ... % points in clusters
'MarkerSize', 8, 'LineWidth', 1.3,'MarkerFaceColor',C(i,:), ...
'MarkerEdgeColor','k');
hold on
plot(Xd(KKM.medoids(i),1), Xd(KKM.medoids(i),2), 'bs', ... % medoids
'MarkerSize', 12, 'LineWidth', 2,'MarkerFaceColor',C(i,:), ...
'MarkerEdgeColor','k');
end
else
figure
plot(Xd(:,1), Xd(:,2), 'o', 'MarkerSize', 8, 'LineWidth', 1.2, ...
'MarkerFaceColor',[0.7 0.7 0.7], 'MarkerEdgeColor','k');
end
hold off
grid off
set(gca,'LineWidth',3)
set(gca,'XTickLabel',{''})
set(gca,'YTickLabel',{''})
end