clear variables;
DirName=pwd;

% load extracted features (step4) 
Fvectmp=dlmread([DirName,'/result/Features.txt']);

plot(Fvectmp(:,1),'-','LineWidth',3,'Color',[25/255    169/255    72/255]);
hold on;
plot(Fvectmp(:,2),'-','LineWidth',3,'Color',[152/255    0/255    46/255]);
plot(Fvectmp(:,3),'-','LineWidth',3,'Color',[236/255    240/255    39/255]);
hold off;
set(gca,'FontSize',18); ylim([-2e5 1e5]);
fig = gcf;
fig.Color = 'white';
fig.InvertHardcopy = 'off';
F=getframe(gcf);
imwrite(uint8(F.cdata),[DirName,'/result/figure_timeseries.png'],'png');
    
Jtmp=eigvec'*mean(Fvectmp,1)';

%%
load([DirName,'/data.mat']);

J=eigvec'*FvecSim';
JDicstarved=eigvec'*FvecDicstarved';
JHL60=eigvec'*FvecHL60';
JKera=eigvec'*FvecKera';
JDicvegitative=eigvec'*FvecDicvegitative';
JDicRacEnull=eigvec'*FvecDicRacEnull';
JHL60Noc=eigvec'*FvecHL60Noc';

figure,
plot(JDicstarved(1,:)',JDicstarved(2,:)','+','LineWidth',8,'Color',[25/255    169/255    72/255]);
hold on;
plot(JHL60(1,:)',JHL60(2,:)','+','LineWidth',8,'Color',[152/255    0/255    46/255]);
plot(JKera(1,:)',JKera(2,:)','+','LineWidth',8,'Color',[236/255    240/255    39/255]);
plot(JDicvegitative(1,:)',JDicvegitative(2,:)','kx','LineWidth',8);
plot(JDicRacEnull(1,:)',JDicRacEnull(2,:)','ks','LineWidth',8);
plot(JHL60Noc(1,:)',JHL60Noc(2,:)','k^','LineWidth',3);
plot(Jtmp(1),Jtmp(2),'o','LineWidth',8,'Color','b');
set(gca,'FontSize',17);
fig = gcf;
fig.Color = 'white';
fig.InvertHardcopy = 'off';
xlim([-1.6e5 0.7e5]); ylim([-0.6e5 1.3e5]);
F=getframe(gcf);
imwrite(uint8(F.cdata),[DirName,'/result/figure1.png'],'png');

figure,
hold on;
plot(J(1,:),J(2,:),'ko','LineWidth',3);
plot(JDicstarved(1,:)',JDicstarved(2,:)','+','LineWidth',8,'Color',[25/255    169/255    72/255]);
plot(JHL60(1,:)',JHL60(2,:)','+','LineWidth',8,'Color',[152/255    0/255    46/255]);
plot(JKera(1,:)',JKera(2,:)','+','LineWidth',8,'Color',[236/255    240/255    39/255]);
plot(J(1,:),J(2,:),'ko','LineWidth',3);
plot(Jtmp(1),Jtmp(2),'o','LineWidth',8,'Color','b');
set(gca,'FontSize',17);
fig = gcf;
fig.Color = 'white';
fig.InvertHardcopy = 'off';
xlim([-1.6e5 0.7e5]); ylim([-0.6e5 1.3e5]);
F=getframe(gcf);
imwrite(uint8(F.cdata),[DirName,'/result/figure2.png'],'png');
