7 views (last 30 days)

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
on 21 Mar 2020

plotyy(x, y1, x, y2,'semilogy', 'plot')

Walter Roberson
on 21 Mar 2020

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');

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

Start Hunting!
## 0 Comments

Sign in to comment.