MATLAB Answers

Problem with axes of plotyy in a loop

3 views (last 30 days)
MichMichel
MichMichel on 23 Oct 2015
Hi :) I don't very like the plotyy function. It makes me crazy a lot ... My problem : I want to hold on different datas on 2 different axes on the same graph.
For exemple :
figure();
hH = []; hV = [];
for i = 1:3
hold on
y1 =rand(1,10);
y2 =rand(1,10)*1000;
t = 1:10;
[ax,hH(i),hV(i)] = plotyy(t,y1,t,y2)
hold off
end
set(ax(1),'Ylim',[0 1],'Ytick',[0:0.025:1]);
set(ax(2),'Ylim',[0 1000],'Ytick',[0:250:1000]);
If i don't set the two axes is ok ! but i want to arrange the Ytick and there are two problems : -1) Tick of the axe Y1 is on the Y2 axe -2) There are overlaps of numbers on the Y2 axe.
I know that there are a lot of same topics on the web but it's not working in my case in a loop
If you have any ideas :) Thanks a lot !

  0 Comments

Sign in to comment.

Answers (0)

Tags