Using hold all with plotyy
Afficher commentaires plus anciens
When I use hold all with plot, all the colors of the lines in the figure can be different automaticly, but when I use it with plotyy , it does not work that well, as there are two handles to hold. So how can I fix it? Thanks. My code is as follows,
x1 = 0:0.01:10;
x2 = 0:1:10;
y1 = sin(x1);
y2 = sin(x2);
y3 = 10*cos(x1/2);
y4 = 10*cos(x2/2);
y5 = x2;
figure
[hAx,hL1,hL2] = plotyy(x1,y1,x2,y2);
set(hAx(1),'YLimMode','auto');
set(hAx(2),'YLimMode','auto');
set(hAx(1),'YTickMode','auto');
set(hAx(2),'YTickMode','auto');
hold(hAx(1),'all');%hold all
hold(hAx(2),'all') ;
plot(hAx(1),x2,y4);
plot(hAx(1),x1,y3);
plot(hAx(2),x2,y5);
hold(hAx(1),'off');%hold off
hold(hAx(2),'off') ;
Réponses (1)
Si
le 3 Fév 2015
Catégories
En savoir plus sur Two y-axis dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!