I would like to know the syntax for plotting two y axes and single x axis for multiple line plots..
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hai,
I would like to know the syntax for plotting two y axes and single x axis for multiple line plots..
e.g. my data were
x1=[0 2 4 6]
x2=[0 2 4 6 810]
x3=[0 2 4 6 8 10 12]
y1=[70 80 90 100]
y2=[85 95 100 105 110 112]
y3=[95 96 98 110 115 119 120]
yy1=[0.2 0.4 0.6 0.8]
yy2=[0.3 0.4 0.6 0.8 1.1 1.2]
yy3=[0.5 0.6 0.7 0.9 1.2 1.6 1.7]
Here, I want to plot y1vs x1, y2 vs x2,y3 vs x3 and yy1 vs x1, yy2 vs x2, yy3 vs x3 as a dual Y axes plots..
Can you guide me to plot these in matlab?
Thanks,
0 Commenti
Risposta accettata
Azzi Abdelmalek
il 19 Lug 2013
ax1=axes('color','none','YAxisLocation','left')
ax2=axes('color','none','YAxisLocation','right')
plot(x3,y3,'b',x2,y2,'b',x1,y1,'b','parent',ax1)
hold on
plot(x3,yy3,'g',x2,yy2,'g',x1,yy1,'g','parent',ax2)
0 Commenti
Più risposte (2)
David Sanchez
il 19 Lug 2013
x1=[0 2 4 6];
x2=[0 2 4 6 8 10];
x3=[0 2 4 6 8 10 12];
y1=[70 80 90 100];
y2=[85 95 100 105 110 112];
y3=[95 96 98 110 115 119 120];
yy1=[0.2 0.4 0.6 0.8];
yy2=[0.3 0.4 0.6 0.8 1.1 1.2];
yy3=[0.5 0.6 0.7 0.9 1.2 1.6 1.7];
plotyy(x1, y1,x2,y2)
hold on
plot(x3,y3,x1,yy1,x2,yy2,x3,yy3)
hold off
0 Commenti
Vedere anche
Categorie
Scopri di più su Two y-axis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!