Code covered by the BSD License  

Highlights from
The Krouchev Journal-Figure Advanced MATLAB Toolkit

image thumbnail

The Krouchev Journal-Figure Advanced MATLAB Toolkit



Toward an advanced Toolkit for Journal-Figure preparation using MATLAB

function zbkfig1(fh,newFig,relScl);
% zbkfig1=Scale down or up a whole figure to better fit the page of the (save as) .pdf
% 	function Naming: zbk = Zoom BacK

% relScl = 0.9;

relPos = (1 - relScl)/2; 

figure(newFig); clf

aav = findobj(fh,'Type','axes');

nAxes = length(aav)

jj = 1:nAxes;

% when the axes replication proceeds in the wrong order 
% i.e. if b/ground axes overlap the f/ground ones
jj = fliplr(jj);

for j = jj

% the Position of the existing axes:
hThis = aav(j); thisPos = get(hThis,'Position');

X0 = thisPos(1); Y0 = thisPos(2); WX = thisPos(3); HY = thisPos(4); 
newSz = relScl*[WX HY];

% the position of given axes (wrt the whole-fig W & H) is in [0,1] normalized units
newOrg = relPos + relScl*[X0 Y0];

hNew = copyobj(hThis,newFig); set(hNew, 'Position', [newOrg newSz]);

end %j (current axes to copy)

Contact us