MATLAB: Is it possible to display multiple y-axes vertically using the same x-axis in MATLAB 7.10 (R2010a)

axislinkaxeslinkpropMATLABplotverticalyy axes

I want to set several lines with different y ranges within one coordinate, when they all have the same x range. I've tried to do that with several axes placed together, but this won't work well when I zoomed the axes. How can I do that in a coordinate?

Best Answer

The ability to generate the coordinate with multiple y-axes vertically is not available in MATLAB R2010a.
To work around, you can link all the axes you've created to make them zoom together. You will achieve that feature with LINKAXES or LINKPROP, for example:
yrng=[1 10 50 100];
y=bsxfun(@times,rand(100,4),yrng);
x=[1:100]';
fh=figure('Name','yplot');
height=0.18;
for i=1:size(y,2)
ah(i)=axes('Parent',fh,'Position',[0.1 (0.15+(i-1)*(height+0.03)) 0.8 height]);
plot(ah(i),x,y(:,i));
if i>1
set(ah(i),'XTickLabel','');
end
end
linkaxes(ah,'x'); % linkprop(ah,'Xlim')
For details on LINKAXES and LINKPROP, please use following command:
>>doc linkaxes;
>>doc linkprop;