y=randi([-50 50],1000,2);
figure
hSP=stackedplot(y);
SPposn=hSP.Position;
figure
for i=1:2, hAx(i)=subplot(2,1,i); end
AXposn=reshape([hAx.Position],4,[]).';
dHt=SPposn(:,4)-sum(AXposn(:,4));
AXposn(:,4)=AXposn(:,4)+dHt/2;
AXposn(1,2)=AXposn(1,2)-dHt/2;
hAx(1).Position=AXposn(1,:);
hAx(2).Position=AXposn(2,:);
hXAx=get(hAx,'XAxis');
cellfun(@(hNR) set(hNR,'Visible','off'),hXAx)
axes(hAx(1))
hold on
plot(y(:,1))
axes(hAx(2))
hold on
plot(y(:,2))