%% 绘图
% fig = figure;% 新建一个figure,并将图像句柄保存到fig
fig = figure('Visible','off'); % 不显示figure
set(gcf,'Position',get(0,'ScreenSize')); % 设置绘图为全屏绘制
set(gca,'FontName','Times New Roman','FontSize',15); % 设置坐标轴的字体和大小
p1=plot(ts,y,':xk','MarkerSize',12,'MarkerFaceColor','k');
p1.LineWidth=2;
% title_name=['Remove One or Multi points in one iteration','(POI ',num2str(i),')'];
% title(title_name);
xlabel('Day Of Year (2019)','FontSize',20);
ylabel('NDVI','FontSize',20);
xlim=[0,366];ylim=[0,1];
set(gca,'xtick',1:16:353,'FontSize',15) % handles可以指定具体坐标轴的句柄
set(gca,'ytick',0:0.1:1,'FontSize',15) % handles可以指定具体坐标轴的句柄
axis([0 366 0 1]);%axis([xmin xmax ymin ymax]),设置绘制区域的范围
%% HANTS重建
hold on;
p2=plot(ts,yr1,'--*g','MarkerSize',14,'MarkerFaceColor','g');
p2.LineWidth=3;
%% iHANTS重建
hold on;
p3=plot(ts,yr2,'-om','MarkerSize',10,'MarkerFaceColor','m');
p3.LineWidth=1.5;
%% 标注参与拟合的点(即权重为1的点)
for marker_index = 1:ni
if p_final_1(marker_index)==1
hold on;
p4=plot(ts(marker_index),y(marker_index),...
'bs','MarkerSize',18,'LineWidth',2,'MarkerEdgeColor','b');
end
if p_final_2(marker_index)==1
hold on;
p5=plot(ts(marker_index),y(marker_index),...
'rp','MarkerSize',18,'LineWidth',2,'MarkerEdgeColor','r');
end
end
%% 绘制图例
leg = legend([p1,p2,p3,p4,p5],{'Original',...
'Reconstructed (HANTS-revised)','Reconstructed (iHANTS-revised)',...
'Fitting points (HANTS-revised)','Fitting points (iHANTS-revised)'},...
'Location','best');
set(leg,'FontName','Times New Roman','FontSize',18,'FontWeight','normal')
%% 写出对比图像
img_name = ['.\',dirname,'\HANTS-revised vs iHANTS-revised','(', LC_type, 'POI ',num2str(i),')'];% 按照POI的序号写出图像
print(img_name,'-dpng','-r0'); % '-r0':以屏幕分辨率保存
%% 关闭绘图
% close all;