Axis for Plotyy for Multiple plots

1 回表示 (過去 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)
  1 件のコメント
anvesh kadimi
anvesh kadimi 2016 年 5 月 15 日
Thanks Very Much

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTwo y-axis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by