clear
load Figure5_Data.mat

fs=10;
figure
set(gcf,'unit','centimeters','position',[10,2,20,12])

% (a) SSP126
ha1=axes('position',[0.046,0.6,0.223,0.35],'fontsize',fs,'fontname','Times New Roman');
set(gcf,'currentaxes',ha1)

yyaxis right
plot(1:12,sm_126,'Linewidth',1.2,'color',cmp1(4,:)./255,'linestyle','-')
hold on
plot(1:12,sm_126,'color',cmp1(4,:)./255,'linestyle','none','marker','.','markersize',12)
ylim([-2 8]) 
xlim([0 13])
set(gca,'fontsize',fs,'tickdir','out','YColor',cmp1(4,:)./255,'fontname','Times New Roman')
set(gca,'ytick',[-2:2:8],'yticklabel',{},'fontname','Times New Roman')  

yyaxis left
h = boxplot(mi_126','colors',myc1,'Symbol','+k','widths',0.5);
set(h,'Linewidth',1.2);
xlabel('Month','fontsize',fs,'fontname','Times New Roman');
ylabel('THE mean intensity change (\circC)','fontsize',fs,'fontname','Times New Roman');
title('(a) SSP126','fontsize',fs,'fontname','Times New Roman');
set(gca,'fontsize',fs,'tickdir','out','YColor',cmp1(end-4,:)./255,'fontname','Times New Roman')
xlim([0 13])
ylim([-2 8]) 
set(gca,'xtick',[1:12],'xticklabel',{'J','F','M','A','M','J','J','A','S','O','N','D'})
set(gca,'ytick',[-2:2:8],'yticklabel',{-2:2:8})  
boxobj=findobj(gca,'Tag','Box');
LW=findobj(gca,'Tag','Lower Whisker');
UW=findobj(gca,'Tag','Upper Whisker');
for j=1:length(boxobj)
   LW(j).LineStyle='-'; 
   UW(j).LineStyle='-'; 
end
grid on


% (b) SSP245
ha2=axes('position',[0.29,0.6,0.2,0.35],'fontsize',fs,'fontname','Times New Roman');
set(gcf,'currentaxes',ha2)

yyaxis right
plot(1:12,sm_245,'Linewidth',1.2,'color',cmp1(4,:)./255,'linestyle','-')
hold on
plot(1:12,sm_245,'color',cmp1(4,:)./255,'linestyle','none','marker','.','markersize',12)
ylim([-2 8]) 
xlim([0 13])
set(gca,'fontsize',fs,'tickdir','out','YColor',cmp1(4,:)./255,'fontname','Times New Roman')
set(gca,'ytick',[-2:2:8],'yticklabel',{})  

yyaxis left
h = boxplot(mi_245','colors',myc1,'Symbol','+k','widths',0.5);
set(h,'Linewidth',1.2);
xlabel('Month','fontsize',fs,'fontname','Times New Roman');
title('(b) SSP245','fontsize',fs,'fontname','Times New Roman');
set(gca,'fontsize',fs,'tickdir','out','YColor',cmp1(end-4,:)./255,'fontname','Times New Roman')
xlim([0 13])
ylim([-2 8]) 
set(gca,'xtick',[1:12],'xticklabel',{'J','F','M','A','M','J','J','A','S','O','N','D'})
set(gca,'ytick',[-2:2:8],'yticklabel',{})  
boxobj=findobj(gca,'Tag','Box');
LW=findobj(gca,'Tag','Lower Whisker');
UW=findobj(gca,'Tag','Upper Whisker');
for j=1:length(boxobj)
   LW(j).LineStyle='-'; 
   UW(j).LineStyle='-'; 
end
grid on


% (c) SSP370
ha3=axes('position',[0.507,0.6,0.2,0.35],'fontsize',fs,'fontname','Times New Roman');
set(gcf,'currentaxes',ha3)

yyaxis right
plot(1:12,sm_370,'Linewidth',1.2,'color',cmp1(4,:)./255,'linestyle','-')
hold on
plot(1:12,sm_370,'color',cmp1(4,:)./255,'linestyle','none','marker','.','markersize',12)
ylim([-2 8]) 
xlim([0 13])
set(gca,'fontsize',fs,'tickdir','out','YColor',cmp1(4,:)./255,'fontname','Times New Roman')
set(gca,'ytick',[-2:2:8],'yticklabel',{})  

yyaxis left
h = boxplot(mi_370','colors',myc1,'Symbol','+k','widths',0.5);
set(h,'Linewidth',1.2);
xlabel('Month','fontsize',fs);
title('(c) SSP370','fontsize',fs,'fontname','Times New Roman');
set(gca,'fontsize',fs,'tickdir','out','YColor',cmp1(end-4,:)./255,'fontname','Times New Roman')
xlim([0 13])
ylim([-2 8]) 
set(gca,'xtick',[1:12],'xticklabel',{'J','F','M','A','M','J','J','A','S','O','N','D'})
set(gca,'ytick',[-2:2:8],'yticklabel',{})  
boxobj=findobj(gca,'Tag','Box');
LW=findobj(gca,'Tag','Lower Whisker');
UW=findobj(gca,'Tag','Upper Whisker');
for j=1:length(boxobj)
   LW(j).LineStyle='-'; 
   UW(j).LineStyle='-'; 
end
grid on

% (d) SSP585
ha4=axes('position',[0.72,0.6,0.205,0.35],'fontsize',fs,'fontname','Times New Roman');
set(gcf,'currentaxes',ha4)

yyaxis right
plot(1:12,sm_585,'Linewidth',1.2,'color',cmp1(4,:)./255,'linestyle','-')
hold on
plot(1:12,sm_585,'color',cmp1(4,:)./255,'linestyle','none','marker','.','markersize',12)
ylim([-2 8])
xlim([0 13])
set(gca,'fontsize',fs,'tickdir','out','YColor',cmp1(4,:)./255,'fontname','Times New Roman')
set(gca,'ytick',[-2:2:8],'yticklabel',{-2:2:8},'fontname','Times New Roman')
ylabel('SST change (\circC)','fontname','Times New Roman');

yyaxis left
h = boxplot(mi_585','colors',myc1,'Symbol','+k','widths',0.5);
set(h,'Linewidth',1.2);
xlabel('Month','fontsize',fs,'fontname','Times New Roman');
title('(d) SSP585','fontsize',fs,'fontname','Times New Roman');
set(gca,'fontsize',fs,'tickdir','out','YColor',cmp1(end-4,:)./255,'fontname','Times New Roman')
xlim([0 13])
ylim([-2 8]) 
set(gca,'xtick',[1:12],'xticklabel',{'J','F','M','A','M','J','J','A','S','O','N','D'})
set(gca,'ytick',[-2:2:8],'yticklabel',{}) 
boxobj=findobj(gca,'Tag','Box');
LW=findobj(gca,'Tag','Lower Whisker');
UW=findobj(gca,'Tag','Upper Whisker');
for j=1:length(boxobj)
   LW(j).LineStyle='-'; 
   UW(j).LineStyle='-'; 
end
grid on



% (e) SSP 126
ha5=axes('position',[0.066,0.21,0.205,0.3],'fontsize',fs,'fontname','Times New Roman');
set(gcf,'currentaxes',ha5)

hold on
for i=1:length(modelname)
    if i<13
        plot(sc_126(i),ma_126(i),'.','MarkerSize',24,...
            'MarkerEdgeColor',myc(i,:)./255)
    else
        plot(sc_126(i),ma_126(i),'s','markersize',7,...
            'MarkerEdgeColor',myc(i-12,:)./255,'MarkerFaceColor',myc(i-12,:)./255)
    end
end
xlabel('SST change (\circC)','fontsize',fs,'fontname','Times New Roman');
ylabel('THE mean intensity change (\circC)','fontsize',fs,'fontname','Times New Roman');
set(gca,'fontsize',fs,'tickdir','out','fontname','Times New Roman')
xlim([0 6])
ylim([-1 4])
set(gca,'ytick',[-1:4],'yticklabel',{-1:4})
set(gca,'xtick',[0:6],'xticklabel',{0:6})
title('(e) SSP126','fontsize',fs,'fontname','Times New Roman');
box on

clear a1 ma1
n=1;
for i=1:18 
    if sc_126(i)~=-1.5e13
    a1(n)=sc_126(i);
    ma1(n)=ma_126(i);
    n=n+1;
    else
        continue
    end
end

[ta,indta]=sort(a1);
tb=ma1(indta);
pp=polyfit(ta,tb,1); 
hold on
x=-0:8;
y=pp(1,1).*x+pp(1,2);
hold on
plot(x,y,'r-','linewidth',1.2)

[RHO,PVAL] = corr(a1',ma1','type','spearman')
text(0.5,3.7,'r = 0.73','fontsize',fs,'fontname','Times New Roman');
text(0.5,3.3,'p < 0.01','fontsize',fs,'fontname','Times New Roman');  % annual

% (f) SSP245
ha6=axes('position',[0.29,0.21,0.2,0.3],'fontsize',fs,'fontname','Times New Roman');
set(gcf,'currentaxes',ha6)

hold on
for i=1:length(modelname)
    if i<13
        plot(sc_245(i),ma_245(i),'.','MarkerSize',24,...
            'MarkerEdgeColor',myc(i,:)./255)
    else
        plot(sc_245(i),ma_245(i),'s','markersize',7,...
            'MarkerEdgeColor',myc(i-12,:)./255,'MarkerFaceColor',myc(i-12,:)./255)
    end
end
xlabel('SST change (\circC)','fontsize',fs,'fontname','Times New Roman');
set(gca,'fontsize',fs,'tickdir','out','fontname','Times New Roman') 
xlim([0 6])
ylim([-1 4])
set(gca,'ytick',[-1:4],'yticklabel',[])
set(gca,'xtick',[0:6],'xticklabel',{0:6})
title('(f) SSP245','fontsize',fs,'fontname','Times New Roman');
box on
clear a1 ma1
n=1;
for i=1:18 
    if sc_245(i)~=-1.5e13
    a1(n)=sc_245(i);
    ma1(n)=ma_245(i);
    n=n+1;
    else
        continue
    end
end

[ta,indta]=sort(a1);
tb=ma1(indta);
pp=polyfit(ta,tb,1); 
hold on
x=-0:8;
y=pp(1,1).*x+pp(1,2);
hold on
plot(x,y,'r-','linewidth',1.2)

[RHO,PVAL] = corr(a1',ma1','type','spearman')
text(0.5,3.7,'r = 0.90','fontsize',fs,'fontname','Times New Roman');
text(0.5,3.3,'p < 0.01','fontsize',fs,'fontname','Times New Roman');  % annual

% (g) SSP 370
ha3=axes('position',[0.507,0.21,0.2,0.3],'fontsize',fs,'fontname','Times New Roman');
set(gcf,'currentaxes',ha3)

hold on
for i=1:length(modelname)
    if i<13
        plot(sc_370(i),ma_370(i),'.','MarkerSize',24,...
            'MarkerEdgeColor',myc(i,:)./255)
    else
        plot(sc_370(i),ma_370(i),'s','markersize',7,...
            'MarkerEdgeColor',myc(i-12,:)./255,'MarkerFaceColor',myc(i-12,:)./255)
    end
end
xlabel('SST change (\circC)','fontsize',fs,'fontname','Times New Roman');
set(gca,'fontsize',fs,'tickdir','out','fontname','Times New Roman') 
xlim([0 6])
ylim([-1 4])
set(gca,'ytick',[-1:4],'yticklabel',[])
set(gca,'xtick',[0:6],'xticklabel',{0:6})
title('(g) SSP370','fontsize',fs,'fontname','Times New Roman');
box on
clear a1 ma1
n=1;
for i=1:18 
    if sc_370(i)~=-1.5e13
    a1(n)=sc_370(i);
    ma1(n)=ma_370(i);
    n=n+1;
    else
        continue
    end
end

[ta,indta]=sort(a1);
tb=ma1(indta);
pp=polyfit(ta,tb,1); 
hold on
x=0:8;
y=pp(1,1).*x+pp(1,2);
hold on
plot(x,y,'r-','linewidth',1.2)

[RHO,PVAL] = corr(a1',ma1','type','spearman')
text(0.5,3.7,'r = 0.96','fontsize',fs,'fontname','Times New Roman');
text(0.5,3.3,'p < 0.01','fontsize',fs,'fontname','Times New Roman');  % annual

% legend

haL=axes('position',[-0.039,-0.088,0.2,0.2],'fontsize',fs-2,'fontname','Times New Roman');
set(gcf,'currentaxes',haL)

hold on
for i=1:length(modelname)
    if i<13
        plot(sc_585(i)-6,ma_585(i)-4,'.','MarkerSize',24,...
            'MarkerEdgeColor',myc(i,:)./255)
    else
        plot(sc_585(i)-6,ma_585(i)-4,'s','markersize',7,...
            'MarkerEdgeColor',myc(i-12,:)./255,'MarkerFaceColor',myc(i-12,:)./255)
    end
end
xlim([0 6])
ylim([-1 4])
legend(modelname,'Location','northeastoutside','fontsize',fs-2,'NumColumns',6,'fontname','Times New Roman')
legend('boxoff')

axis off 


%   (h) SSP 585 annual
ha4=axes('position',[0.724,0.21,0.2,0.3],'fontsize',fs,'fontname','Times New Roman');
set(gcf,'currentaxes',ha4)

hold on
for i=1:length(modelname)
    if i<13
        plot(sc_585(i),ma_585(i),'.','MarkerSize',24,...
            'MarkerEdgeColor',myc(i,:)./255)
    else
        plot(sc_585(i),ma_585(i),'s','markersize',7,...
            'MarkerEdgeColor',myc(i-12,:)./255,'MarkerFaceColor',myc(i-12,:)./255)
    end
end
xlabel('SST change (\circC)','fontsize',fs,'fontname','Times New Roman');
set(gca,'fontsize',fs,'tickdir','out','fontname','Times New Roman') 
xlim([0 6])
ylim([-1 4])
set(gca,'ytick',[-1:4],'yticklabel',{})
set(gca,'xtick',[0:6],'xticklabel',{0:6})
title('(h) SSP585','fontsize',fs,'fontname','Times New Roman');
box on

clear a1 ma1
n=1;
for i=1:18 
    if sc_585(i)~=-1.5e13
    a1(n)=sc_585(i);
    ma1(n)=ma_585(i);
    n=n+1;
    else
        continue
    end
end

[ta,indta]=sort(a1);
tb=ma1(indta);
pp=polyfit(ta,tb,1); 
hold on
x=0:8;
y=pp(1,1).*x+pp(1,2);
hold on
plot(x,y,'r-','linewidth',1.2)

[RHO,PVAL] = corr(a1',ma1','type','spearman')
text(0.5,3.7,'r = 0.92','fontsize',fs,'fontname','Times New Roman');
text(0.5,3.3,'p < 0.01','fontsize',fs,'fontname','Times New Roman');  % annual


print(gcf,'-dpdf','-r600','D:\data_code_figures\figures\Figure5.pdf')