could anyone help me how to avoid the repetition of y axis values on the right with respect to the following code
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
Rui Wang Wang
2020년 3월 21일
%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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!