Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pos_factor = 0.5;
- clf
- f1= subplot( 2,1,1);
- plot(x,sin(x));
- f2= subplot( 2,1,2);
- plot(x,cos(x),'r');
- p1 = get(f1,'position');
- p2 = get(f2,'position');
- l2 = ylabel('lalala');
- l2p = get(l2,'position'); % posicion de ylabel en coords axis2
- yM1 = p1(2)+p1(4); % lim sup de f1 en coordenadas de figure
- yM2 = p2(2)+p2(4); % lim sup de f2 en coordenadas de figure
- ym2 = p2(2); % lim inf de f2 en coordenadas de figure
- axis2 = axis(f2);
- %transformacion de coordenadas de axis2 a coordenadas de figure
- m = (yM2-ym2)/(axis2(4)-axis2(3));
- n = ym2 - m*axis2(3);
- y02 = m*0+n; %posicion del y=cero de axis2 en figure
- yM1_2 = (yM1-n)/m; %posicion del tope sup de axis1 en coord axis2
- ym2_2 = axis2(3); % posicion del tope inf de axis2 en coord axis2
- l2p(2) = (yM1_2-ym2_2)*pos_factor+ym2_2;
- set(l2,'position',l2p)
Advertisement
Add Comment
Please, Sign In to add comment