Axis for Plotyy for Multiple plots

1 vue (au cours des 30 derniers jours)
anvesh kadimi
anvesh kadimi le 15 Mai 2016
Modifié(e) : dpb le 16 Mai 2016
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

Réponse acceptée

dpb
dpb le 15 Mai 2016
Modifié(e) : dpb le 16 Mai 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)
  1 commentaire
anvesh kadimi
anvesh kadimi le 15 Mai 2016
Thanks Very Much

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Two y-axis dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by