could anyone help me how to avoid the repetition of y axis values on the right with respect to the following code
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
jaah navi
am 21 Mär. 2020
Beantwortet: Rui Wang Wang
am 21 Mär. 2020
Code:
x=1:5
y1=[ 3.5743 2.4635 1.6621 1.3403 0.5476 ];
y2=[3890000 4168000 4446000 4724000 4999000 ]
y3=[ 1.5543 1.1435 0.6421 0.2303 0.1476 ];
y4=[4190000 4454000 4718000 4982000 5346000 ]
figure
[hAx,hLine1,hLine2] = plotyy(x, y1, x, y2,@(X,Y)semilogy(X,Y,'k'), @(X,Y)plot(X,Y,'k'))
hold on;
[hAx,hLine3,hLine4] = plotyy(x, y3, x, y4,@(X,Y)semilogy(X,Y,'k'), @(X,Y)plot(X,Y,'k'))
wheni run i can get the graph but y axis values on the right is occuring more than once.
Could anyone please help me how to avoid it.
0 Kommentare
Akzeptierte Antwort
Rui Wang Wang
am 21 Mär. 2020
%Make the scale range of the two graphs equal , I added four "set" to set the scale , and i suggest you set different colors .
x=1:5
y1=[ 3.5743 2.4635 1.6621 1.3403 0.5476 ];
y2=[3890000 4168000 4446000 4724000 4999000 ]
y3=[ 1.5543 1.1435 0.6421 0.2303 0.1476 ];
y4=[4190000 4454000 4718000 4982000 5346000 ]
figure
[hAx1,hLine1,hLine2] = plotyy(x, y1, x, y2,@(X,Y)semilogy(X,Y,'k'), @(X,Y)semilogy(X,Y,'k'));
set(hAx1(1),'ylim',[0 5]);
set(hAx1(2),'ylim',[3890000 5346000 ]);
hold on;
[hAx2,hLine3,hLine4] = plotyy(x, y3, x, y4,@(X,Y)semilogy(X,Y,'k'), @(X,Y)semilogy(X,Y,'k'));
set(hAx2(1),'ylim',[0 5]);
set(hAx2(2),'ylim',[3890000 5346000 ]);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!