How to use plotyy for two sets of data?

Hey, I have to plot x versus ya1,ya2,ya3 plots and compare it by overplotting yb1,yb2,yb3 for the same xa. I used plotyy to do that but I have trouble with axes scale's.
[hAx,hx1,hx2] = plotyy(x,ya1,[x,x],[ya2,ya3])
hold on;
[hAx_1,hx1_1,hx2_1] = plotyy(x,yb1,[x,x],[yb2,yb3])
% Tried matching axis using
set(hAx(2),'xtick',get(hAx(1),'xtick'),'xticklab',get(hAx(1),'xticklab'))
set(hAx_1(1),'xtick',get(hAx(1),'xtick'),'xticklab',get(hAx(1),'xticklab'))
set(hAx_1(2),'xtick',get(hAx_1(1),'xtick'),'xticklab',get(hAx_1(1),'xticklab'))
set(hAx_1(1),'ytick',get(hAx(1),'ytick'),'yticklab',get(hAx(1),'yticklab'))
set(hAx_1(2),'ytick',get(hAx(2),'ytick'),'yticklab',get(hAx(2),'yticklab'))
But still no use. Need help. Thanks in advance

1 Comment

Please explain the troubles you have. We cannot guess this important detail.

Sign in to comment.

Answers (0)

Categories

Asked:

on 28 Apr 2017

Commented:

Jan
on 28 Apr 2017

Community Treasure Hunt

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

Start Hunting!