Could anyone help me how to plot the graph with respect to x axis in normal form and one y axis in semilog and other y axis in normal form.

조회 수: 5 (최근 30일)
I am having the data in x,y1,y2
in graph i want to have x and y2 in normal and y1 should be in semilog.
When i used the command plotyy(x,y1,x,y2,'loglog')
all three appears to be in semilog
couly anyone help me how to make y1 alone in semilog and x and y2 in normal.

채택된 답변

Walter Roberson
Walter Roberson 2020년 3월 21일
plotyy(x, y1, x, y2,'semilogy', 'plot')
  댓글 수: 4
jaah navi
jaah navi 2020년 3월 21일
It works.
Could you please help me to check with the following 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'))
when i run the above code the y axis value on the right is repeated more than one.
Could you please help me how to overcome it.
Walter Roberson
Walter Roberson 2020년 3월 21일
plotyy() always creates a new right axes; one of the advantages of the newer yyaxis() is that it only creates the second axes if needed.
You do not want a new axes created; you want to re-use the existing ones.
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(hAx,'on');
plot(hAx(1), x, y3, 'k'); %axes is already set to semilogy
plot(hAx(2), x, y4, 'k');

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by