我想用matlab画下面的图,上下堆叠起来,共用一个横坐标轴,请高手指点!!
subplot(311),
%plot(...);
set(gca,'xlim',[0 1.2]);
set(gca,'ylim',[0 4.8]);
set(gca,'xticklabel',[]);
set(gca,'box','on');
set(gca,'position',[0.15 0.65 0.75 0.27]);
subplot(312),
%plot(...);
set(gca,'xlim',[0 1.2]);
set(gca,'ylim',[0.9 2.7]);
set(gca,'xticklabel',[]);
set(gca,'box','on');
set(gca,'position',[0.15 0.38 0.75 0.27]);
ylabel('\sigma_{T}');
subplot(313),
%plot(...);
set(gca,'xlim',[0 1.2]);
set(gca,'ylim',[1.1 2.1]);
set(gca,'box','on');
set(gca,'position',[0.15 0.11 0.75 0.27]);
xlabel('eV/\Delta');
根据你的例子,让三个坐标有不同的y坐标,但x坐标相同,并连在一起
只是没有数据,所以画图语句plot缺省,换上需要的画图指令就可以
非常感谢!请问以下几句代码是代表什么意思?set(gca,'xlim',[0 1.2]);set(gca,'ylim',[0 4.8]);set(gca,'position',[0.15 0.65 0.75 0.27]);
set(gca,'xlim',[0 1.2]); %坐标x轴范围
set(gca,'ylim',[0 4.8]);%坐标y轴范围
set(gca,'position',[0.15 0.65 0.75 0.27]);%整个坐标区域在fig窗口中的位置
clear;
load('Setup81360.mat')
ta=min(t_lh1);
tb=max(t_lh1);
figure(1)
axes('position',[0.15 0.74 0.8 0.16])
plot(t_lh1,lh1/1000.0,t_lh2,lh2/1000.0)
title(strcat('EAST #',shot),'Fontsize', 14)
ylabel('P_{LH} (MW)','Fontsize', 12)
legend({'LH1','LH2'},'Fontsize', 10)
set(gca,'xticklabel',[])
xlim([ta,tb])
ylim([0,1.5])
set(gca,'ytick',0.3:0.3:1.2)
box off
ax2 = axes('Position',get(gca,'Position'),...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none',...
'XColor','k','YColor','k');
set(ax2,'YTick', []);
set(ax2,'XTick', []);
box on
axes('position',[0.15 0.58 0.8 0.16])
plot(t_wmhd,wmhd/1000.0)
ylabel('Q (kJ)','Fontsize', 12)
legend({'Stored energy'},'Fontsize', 10)
xlim([ta,tb])
ylim([0,150])
set(gca,'ytick',30:30:120)
set(gca,'xticklabel',[])
%set(gca,'xtick',[])
box off
ax2 = axes('Position',get(gca,'Position'),...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none',...
'XColor','k','YColor','k');
set(ax2,'YTick', []);
set(ax2,'XTick', []);
box on
axes('position',[0.15 0.42 0.8 0.16])
plot(t_ne,ne)
ylabel('N_e (10^{19})','Fontsize', 12)
legend({'Density'},'Fontsize', 10)
xlim([ta,tb])
ylim([0,6])
set(gca,'ytick',1:2:5)
set(gca,'xticklabel',[])
%set(gca,'xtick',[])
box off
ax2 = axes('Position',get(gca,'Position'),...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none',...
'XColor','k','YColor','k');
set(ax2,'YTick', []);
set(ax2,'XTick', []);
box on
axes('position',[0.15 0.26 0.8 0.16])
plot(t_da2,smooth(da2,50))
xlim([ta,tb])
ylim([0,11])
set(gca,'ytick',1:3:10)
legend({'DAU1'},'Fontsize', 10)
ylabel('D\alpha','Fontsize', 12)
set(gca,'xticklabel',[])
%set(gca,'xtick',[])
box off
ax2 = axes('Position',get(gca,'Position'),...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none',...
'XColor','k','YColor','k');
set(ax2,'YTick', []);
set(ax2,'XTick', []);
box on
axes('position',[0.15 0.10 0.8 0.16])
plot(t_rmp1,rmp1/1000.0,t_rmp2,rmp2/1000.0,t_rmp3,rmp3/1000.0,t_rmp4,rmp4/1000.0)
xlim([ta,tb])
ylim([-3.5,3.5])
set(gca,'ytick',-3:2:3)
legend({'RMPL1','RMPL2','RMPL3','RMPL4'},'Fontsize', 10)
xlabel('Time (s)','Fontsize', 12);
ylabel('I_{RMP} (kA)','Fontsize', 12)
box off
ax2 = axes('Position',get(gca,'Position'),...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none',...
'XColor','k','YColor','k');
set(ax2,'YTick', []);
set(ax2,'XTick', []);
box on