Matlab 多个图像共用一个横坐标 subplot、plotyy
x=0:0.1:7;
h1=subplot(3,1,1);
plot(x,sin(x),'k');
h2=subplot(3,1,2);
plot(x,cos(x),'k');
set([h1,h2],'Xcolor','w','XTick',[]) %将前两个x坐标设为白色,且不显示xtick
% 利用plotyy双轴显示同一个图像,一副显示左y,下x,另一幅显示右y,下x
h3=subplot(3,1,3);
[ax,h4,h5]=plotyy(x,sec(x),x,sec(x));
box off
set(ax(1),'YColor','k')%k 黑色
set(ax(2),'Xaxislocation','bottom','YColor','k')
set(h5,'color','k')
set(gcf,'color','w') % 背景色设为白色,间接隐藏所有白色轴线
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
x = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
[AX,H1,H2] =
plotyy(x,y1,x,y2,'plot');ylabel('First
axes1');
set(AX(1),'ylim',[-300 300]); %
坐标轴范围
set(AX(1),'ytick',[-300:100:300])
%坐标轴刻度 划分这么多个范围 set(AX(1),'yticklabel',[-300:100:300])
set(AX(1),'box','off')
set(get(AX(2),'ylabel'),'string','Second axes2');
set(AX(2),'ylim',[-1 1]);
set(AX(2),'ytick',[-1:.5:1])
set(AX(2),'yticklabel',[-1:.5:1])
set(AX(2),'xaxislocation','top')%%%%%%%%%%坐标轴位置
+++++++++++++++++++++++++++++&#