0
votes

Is there anyway that I can selectively zoom on the two data sets when I am using plotyy?

In other words I want to re-scale and position the the data separately after plotting and can't seem to make this happen as of now. I came across the following but, I wasn't sure how I could convert it into a function for automatic plotting using plotyy:

MATLAB - Pan a plot independently of other plots in the same axes

1

1 Answers

0
votes

Yeah plotyy is weird like that. One thing you could try, though, is to extract the two lines and then apply rescaling manually like:

plotyy(x1,y1,x2,y2);

lines=findobj(gca,'type','line'); % this results in a size=2 array 
Y=get(lines(1),'ydata');
set(lines(1),'ydata',Y*2);    
% this multiplies the lines(1), which is usually the (x2,y2) line, by two

I haven't tried this myself, so given that plotyy draws another green axis on the right, maybe you'll get that in your lines array when you try the findobj too. Play around with it, hopefully this would be helpful.