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

1 次查看(过去 30 天)
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?

采纳的回答

MathWorks Support Team
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;

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Visual Exploration 的更多信息

产品


版本

R2012b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by