figure;
set(gcf,'Position',[80 80 1000 700]) %设置图片整体大小,四个参数分别为xmin,ymin,width,height
ha = tight_subplot(1,1,[.08 .03],[.05 .05],[.03 .03]);
axes(ha(1));
%line([1,2],[3,4])将画出(1,3)到(2,4)的一条直线
plot([2023 2023],[0,380],'r-');
s=0;
for i=6:6:372
hold on
plot([2011 2035],[i,i],'--','color',[0.5 0.5 0.5]);
s=s+1;
hold on
scatter(ts.timeseries(s).time+1,ts.timeseries(s).u*100+i,'.','g');
hold on
text('String',ts.timeseries(s).site.name,'Position',[2010.3 i],'FontSize',5);
s=s+1;
hold on
scatter(ts.timeseries(s).time+13,ts.timeseries(s).u*100+i,'.','g');
hold on
text('String',ts.timeseries(s).site.name,'Position',[2035.1 i],'FontSize',5);
end
set(gca,'XLim',[2010 2036]);%X轴的数据显示范围
set(gca, 'xTick', 2010:2:2036);%设置刻度线
set(gca,'XTickLabel',{'2010','2012','2014','2016','2018','2020','2022', ...
'2010','2012','2014','2016','2018','2020','2022', },'FontSize',8);%设置刻度线下面显示数字
set(gca,'YLim',[0 380]);%X轴的数据显示范围
set(gca, 'yTick', 0:30:380);%设置刻度线
%set(gca,'XTickLabel',{'2010','2012','2014','2016','2018','2020','2022', ...
% '2010','2012','2014','2016','2018','2020','2022', },'FontSize',8);%设置刻度线下面显示数字
ax1 = gca; % current axes
hold on
%上侧、右侧坐标轴显示方法
%'Color','none'参数很关键,不然会遮盖之前绘制的图形
ax2 = axes('Position',get(ax1,'Position'),'xAxisLocation','top','yAxisLocation','right','Color','none','XColor','k','YColor','k');
set(gca,'XLim',[2009 2036]);%X轴的数据显示范围
set(gca, 'xTick', 2010:2:2036);%设置刻度线
set(gca,'XTickLabel',{'2010','2012','2014','2016','2018','2020','2022', ...
'2010','2012','2014','2016','2018','2020','2022', },'FontSize',8);%设置刻度线下面显示数字
set(gca,'YLim',[0 380]);%X轴的数据显示范围
set(gca, 'yTick', 0:30:380);%设置刻度线
转载本文请联系原作者获取授权,同时请注明本文来自陈超科学网博客。
链接地址:https://wap.sciencenet.cn/blog-858128-1336853.html?mobile=1
收藏