Axis for Plotyy for Multiple plots

조회 수: 28 (최근 30일)
anvesh kadimi
anvesh kadimi 2016년 5월 15일
편집: dpb 2016년 5월 16일
Hello,
I'm using Plotyy as
[haxes(1:2),hline1,hline2] = plotyy(x1,y1,x1,y2);
set(haxes(1:2),'NextPlot','add');
plot(haxes(1),x1,y3,'-r','LineWidth',1.5)
plot(haxes(2),x1,y4,'-blue','LineWidth',1.5)
%Now I'm setting for a Region of Interest(ROI) plot
axis([28 38 -1000 1000])
The Problem is when I set the axis, it is showing the zoomed/ ROI of the last 2 plots of y3 and y4, but not the ROI for y1 and y2. (Its not setting the axes automatically for the x1,y1 and x2,y2) Please suggest me how to proceed. Thanks in Advance

채택된 답변

dpb
dpb 2016년 5월 15일
편집: dpb 2016년 5월 16일
[hAx,hL1,hL2] = plotyy(x1,y1,x1,y2);
set(hAx,'NextPlot','add')
plot(hAx(1),x1,y3,'-r','LineWidth',1.5)
plot(hAx(2),x1,y4,'-blue','LineWidth',1.5)
linkaxes(hAx) % key missing ingredient...link the axes you want same
axis(hAx(1), [28 38 -1000 1000]) % now all axes in hAx will stay in synch with hAx(1)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Two y-axis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by