Axis for Plotyy for Multiple plots
1 view (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
dpb
on 15 May 2016
Edited: dpb
on 16 May 2016
[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)
More Answers (0)
See Also
Categories
Find more on Two y-axis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!