-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdrawNemenyi.m
85 lines (75 loc) · 2.27 KB
/
drawNemenyi.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
function drawNemenyi(Results,Names,OutFolder,OutName)
figure(1)
cd = fsCD(Results);
Ne = size(Results,2);
for i = 1:size(Results,1)
Ran(i,:) = tiedrank(Results(i,:));
end
plot([1 Ne],[0 0],'k')
hold on
plot(1:Ne,zeros(1,Ne),'k+')
xlim([-1 Ne+2])
plot(mean(Ran),zeros(1,Ne),'r.')
if Ne > 8
ylim([-0.4 0.3])
else
ylim([-0.3 0.3])
end
[RanSort,RanIndx] = sort(mean(Ran),'ascend');
divInd = round(length(RanSort)/2);
LinSpa = 0.05;
for i = 1:divInd
plot([RanSort(i) RanSort(i)],[-0.01 -0.01-(i*LinSpa)],'r')
plot([1 RanSort(i)],[-0.01-(i*LinSpa) -0.01-(i*LinSpa)],'r')
text(0.9,-0.01-(i*LinSpa),char(Names(RanIndx(i))),'HorizontalAlignment','right')
end
i = 1;
for c = length(RanSort):-1:divInd+1
plot([RanSort(c) RanSort(c)],[-0.01 -0.01-(i*LinSpa)],'r')
plot([RanSort(c) Ne],[-0.01-(i*LinSpa) -0.01-(i*LinSpa)],'r')
text(Ne+.1,-0.01-(i*LinSpa),char(Names(RanIndx(c))))
i = i+1;
end
for i = 1:length(RanSort)
text(i-0.08,0.035,num2str(i),'FontSize',7,'VerticalAlignment','top')
end
h=plot([1 1],[0.048 0.052]);
plot([1+cd 1+cd],[0.048 0.052],'Color',h.Color);
plot([1 1+cd],[0.05 0.05],'Color',h.Color);
text(1, 0.05+0.02, 'CD','Color',h.Color)
%% Draw significant lines
Temp = Results(:,RanIndx);
[p, Nemenyi, meanrank, CDa, rankmean] = nemenyi(Temp, 1);
if p<0.05
NEM = tril(Nemenyi==1);
Ind = zeros(1,size(NEM,2));
for i = 1:size(NEM,2)
[aa,bb] = find(NEM(:,i)==0);
if numel(aa)~=0;Ind(i) = aa(end);end
end
[C,ia,ic] = unique(Ind);
count = 1;
for i = ia' %size(unique(Ind),1)
if Ne > 1 % change this to 4 later
if mod(count,2)==0
plot([RanSort(i) RanSort(C(count))],...
[-0.01-(2*LinSpa*0.4) -0.01-(2*LinSpa*0.4)]);
else
plot([RanSort(i) RanSort(C(count))],...
[-0.01-(LinSpa*0.4) -0.01-(LinSpa*0.4)]);
end
count=count+1;
else
error('Matrix size is can not be Nx1')
end
end
end
title(['Friedman p = ' num2str(p)])
%% print
box off
axis off
set(gca,'LineWidth',0.75,'FontSize',8,'FontName','Arial');
set(gcf, 'PaperUnits', 'centimeters');
set(gcf, 'PaperPosition', [0 0 12 8]);
print('-dtiff' ,'-r600',[OutFolder '/' OutName '.tif'])
% close(1)