-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPlot_time_series.m
69 lines (62 loc) · 1.64 KB
/
Plot_time_series.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
function Plot_time_series(wplot,hplot,c,p,centroid,nor_traj,t_traj,clusterCount,fig_no,showMems)
if (wplot==0 || hplot==0)
wplot=ceil(nthroot(clusterCount,2));
if (wplot*(wplot-1))>clusterCount
hplot= wplot-1;
else
hplot=wplot;
end
end
%--incremental Plot--------------------------------------------------------------
if clusterCount> wplot*hplot;
clusterCount=2;
rrr=wplot*hplot;
% if wplot==hplot || wplot>hplot
% hplot=hplot+1;
% else
% wplot=wplot+1;
% end
else
rrr=clusterCount;
end
if isempty(t_traj)
for i=1:length(nor_traj)
t_traj{i}=[1:1:length(nor_traj{1})];
end
end
clus=cell(1,clusterCount);
figure(fig_no);
clf(fig_no);
hold off
for j=1:clusterCount
memStr=[];
clus{j}=find(c(:,1)==j);
%combinedStr=strcat('(cluster:',num2str(j),')');
ax = subplot(hplot,wplot,j);
cla(ax);
ttt=10;
cc=hsv(ttt); %(length(clus{j}));
if length(clus{j})<ttt
ttt=length(clus{j});
end
for i=1:ttt %length(clus{j})
ind=clus{j}(i,1);
if showMems==1
memStr = strcat(memStr,',',num2str(ind));
elseif showMems==2
memStr = strcat(memStr,',',num2str(p(ind)));
end
color=cc(i,:);
plot(t_traj{ind},nor_traj{ind},'color',color,'LineWidth',2)
hold on
end
if ~isempty(centroid)
ti=(1:length(centroid{j}));
plot(ti,centroid{j},'--b','LineWidth',2)
end
combinedStr = strcat('Clus(',num2str(length(clus{j})),')');
if showMems>0
combinedStr = strcat(combinedStr,'-',memStr);
end
title(combinedStr);
end