-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcell_visu_PRE.m
121 lines (91 loc) · 2.59 KB
/
cell_visu_PRE.m
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
function [] = cell_visu_PRE(result, true_label, label_legend)
% result{1} = H;
C = result{2};
cpi = result{3};
% result{4} = cluster_location;
% result{5} = cell_location;
cell_location= result{6};
% result{7} = C_TC;
%PRE visualization
%get the locaion of cluster centers
No_cluster = length(unique(C));
zzz = get(gca,'colororder');
mycolor = zeros(13,3);
mycolor(1:7,:) = zzz;
mycolor(8,:) = [0 0 0];
mycolor(9,:) = [0 0 0.803922];
mycolor(10,:) = [1 0 1];
mycolor(11,:) = [0.5 1 0];
mycolor(12,:) = [0, 0.75, 0.75];
mycolor(13,:) = [0, 0.5, 0];
ss=30;
%plot clustering
for i = 1:No_cluster
index1 = find(C==i);
scatter(cell_location(index1,1),cell_location(index1,2),ss,mycolor(i,:),'filled','o','MarkerEdgeAlpha',0.6,'MarkerFaceAlpha',0.6);
hold on
end
hold off
set(gca,'xtick',[]);
set(gca,'ytick',[]);
title('Clustering')
cluster_name = cell(1,No_cluster);
for i = 1:No_cluster
cluster_name{i} = ['C' num2str(i)];
end
legend(cluster_name,'FontSize',12,'Location','best')
box on
% plot true_label
figure
for i = 1:length(unique(true_label))
index1 = find(true_label==i);
scatter(cell_location(index1,1),cell_location(index1,2),ss,mycolor(i,:),'filled','o','MarkerEdgeAlpha',0.6,'MarkerFaceAlpha',0.6);
hold on
end
hold off
set(gca,'xtick',[]);
set(gca,'ytick',[]);
title('True labels')
legend(label_legend,'FontSize',12,'Location','best')
box on
% plot CPI
figure
scatter(cell_location(:,1),cell_location(:,2),ss,cpi,'filled','o','MarkerEdgeAlpha',0.6,'MarkerFaceAlpha',0.6);
set(gca,'xtick',[]);
set(gca,'ytick',[]);
title('CPI labels')
box on
%plot CPI
%
% ss=30;
% for i = 1:No_cluster
% for j = 1:length(unique(true_label))
% index1 = find(C==i & true_label==j);
%
% if Marker_type(j)=='p'
% scatter(cell_location(index1,1),cell_location(index1,2),ss*2,cpi(index1),'filled',Marker_type(j),'MarkerEdgeAlpha',0.6,'MarkerFaceAlpha',0.6);
% hold on
% else
% scatter(cell_location(index1,1),cell_location(index1,2),ss,cpi(index1),'filled',Marker_type(j),'MarkerEdgeAlpha',0.6,'MarkerFaceAlpha',0.6);
% hold on
% end
% end
% end
% colorbar
% xlim([-1.1 1.1])
% ylim([-1.15 1.1])
% hold off
%
% set(gca,'xtick',[]);
% set(gca,'ytick',[]);
%
% box on
% fig = gcf;
% fig.PaperPositionMode = 'auto';
%
% a=5; b=3.8;
% set(gcf, 'Units', 'Inches', 'Position', [0, 0, a, b], 'PaperUnits', 'Inches', 'PaperSize', [a, b])
% fig.OuterPosition=fig.InnerPosition;
%
% print([folder '\cell_visu_CPI'],'-dpdf','-r300','-fillpage');
end