0001 function [lspace,bspace,apos_new] = resizejd(ax,fac,lspace,bspace)
0002
0003 if nargin < 4
0004 bspace = NaN;
0005 end
0006 if nargin < 3
0007 lspace = NaN;
0008 end
0009 if nargin < 2
0010 fac = 1;
0011 end
0012
0013 set(ax,'units','normalized')
0014 apos = get(ax,'position');
0015
0016 al = apos(1);
0017 ab = apos(2);
0018 aw = apos(3);
0019 ah = apos(4);
0020
0021 if length(fac) == 1
0022 aw_new = fac*aw;
0023 ah_new = fac*ah;
0024 else
0025 aw_new = fac(1)*aw;
0026 ah_new = fac(2)*ah;
0027 end
0028
0029 if isnan(lspace)
0030 lspace = al/(1 - aw);
0031 end
0032 if isnan(bspace)
0033 bspace = ab/(1 - ah);
0034 end
0035
0036 al_new = lspace*(1 - aw_new);
0037 ab_new = bspace*(1 - ah_new);
0038
0039 apos_new = [al_new,ab_new,aw_new,ah_new];
0040 set(ax,'position',apos_new);
0041
0042
0043
0044
0045
0046
0047
0048