clear
load Figure6_data.mat

figure
set(gcf,'unit','centimeters','position',[1,2,20,9])

% 1 plot bars of MHW changes under SSPs
ha1=axes('position',[0.04,0.58,0.42,0.37],'fontname','Times New Roman');
set(gcf,'currentaxes',ha1);
h = boxplot(mhw_meanint,'colors',myc,'Symbol','+k','widths',0.8);
set(h,'Linewidth',1.2);
set(gca,'xtick',[3.5,9.5,15.5,21.5],'xticklabel',{'SSP126','SSP245','SSP370','SSP585'},'fontname','Times New Roman')
set(gca,'fontsize',fs,'tickdir','out')
ylabel('\circC','fontsize',fs,'fontname','Times New Roman');
title('(a) MHW mean intensity change','fontsize',fs,'fontname','Times New Roman');
ylim([-0.2 1])
set(gca,'ytick',-0.2:0.2:1,'yticklabel',{-0.2:0.2:1},'fontname','Times New Roman')
text(1,0.85,'Arctic Ocean','fontsize',fs,'color',cmp1(end-4,:)./255,'fontname','Times New Roman');
text(1,0.7,'Global Ocean','fontsize',fs,'color',cmp1(4,:)./255,'fontname','Times New Roman');
grid on
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

% 2 plot bars of MHW tdays changes under SSPs
ha2=axes('position',[0.54,0.58,0.42,0.37],'fontname','Times New Roman');
set(gcf,'currentaxes',ha2);
h = boxplot(mhw_tdays,'colors',myc,'Symbol','+k','widths',0.8);
set(h,'Linewidth',1.2);
set(gca,'xtick',[3.5,9.5,15.5,21.5],'xticklabel',{'SSP126','SSP245','SSP370','SSP585'},'fontname','Times New Roman')
set(gca,'fontsize',fs,'tickdir','out')
ylabel('days','fontsize',fs,'fontname','Times New Roman');
title('(b) MHW annual total days change','fontsize',fs,'fontname','Times New Roman');
ylim([-4 16])
set(gca,'ytick',-4:4:16,'yticklabel',{-4:4:16},'fontname','Times New Roman')
text(1,14,'Arctic Ocean','fontsize',fs,'color',cmp1(end-4,:)./255,'fontname','Times New Roman');
text(1,12,'Global Ocean','fontsize',fs,'color',cmp1(4,:)./255,'fontname','Times New Roman');
grid on
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

% 3. plot bars of THE changes under SSPs
ha3=axes('position',[0.04,0.08,0.42,0.37],'fontname','Times New Roman');
set(gcf,'currentaxes',ha3);
h = boxplot(the_meanint,'colors',myc,'Symbol','+k','widths',0.8);
set(h,'Linewidth',1.2);
set(gca,'xtick',[3.5,9.5,15.5,21.5],'xticklabel',{'SSP126','SSP245','SSP370','SSP585'},'fontname','Times New Roman')
set(gca,'fontsize',fs,'tickdir','out')
ylabel('\circC','fontsize',fs,'fontname','Times New Roman');
title('(c) THE mean intensity change','fontsize',fs,'fontname','Times New Roman');
ylim([-1 4])
text(1,3.3,'Arctic Ocean','fontsize',fs,'color',cmp1(end-4,:)./255,'fontname','Times New Roman');
text(1,2.7,'Global Ocean','fontsize',fs,'color',cmp1(4,:)./255,'fontname','Times New Roman');
grid on
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

% 4. plot bars of THE changes under SSPs
ha4=axes('position',[0.54,0.08,0.42,0.37],'fontname','Times New Roman');
set(gcf,'currentaxes',ha4);
set(gcf,'unit','centimeters','position',[1,2,20,8])
h = boxplot(the_tdays,'colors',myc,'Symbol','+k','widths',0.8);
set(h,'Linewidth',1.2);
set(gca,'xtick',[3.5,9.5,15.5,21.5],'xticklabel',{'SSP126','SSP245','SSP370','SSP585'},'fontname','Times New Roman')
set(gca,'fontsize',fs,'tickdir','out')
ylabel('days','fontsize',fs,'fontname','Times New Roman');
title('(d) THE annual total days change','fontsize',fs,'fontname','Times New Roman');
ylim([0 365])
set(gca,'ytick',[0:100:300,365],'yticklabel',{0:100:300,365})
text(1,330,'Arctic Ocean','fontsize',fs,'color',cmp1(end-4,:)./255,'fontname','Times New Roman');
text(1,290,'Global Ocean','fontsize',fs,'color',cmp1(4,:)./255,'fontname','Times New Roman');
grid on
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
print(gcf,'-dpdf','-r600','D:\data_code_figures\figures\Figure6.pdf')