source: MML/trunk/applications/common/subfig.m

Last change on this file was 4, checked in by zhangj, 11 years ago

Initial import--MML version from SOLEIL@2013

File size: 1.4 KB
Line 
1function h = subfig(a, b, c, h)
2%SUBFIG - Pops the current axes into a separate figure
3%  h = subfig(s1, s2, s3, h_fig)
4%
5%  Written by Greg Portmann
6
7
8if nargin < 3
9    error('3 inputs required');
10end
11if nargin < 4
12    h = figure;
13else
14    h = figure(h);
15end
16
17s = get(0, 'ScreenSize');
18
19xbuf = .02 * s(3);
20ybuf = .06 * s(4);
21
22CommandWindowUnits = get(0,'Units');
23FigUnits = get(h,'Units');
24set(h,'Units', CommandWindowUnits);
25
26
27Nx = 5;
28Ny = 2;
29if a == 1 & b == 1
30    set(h, 'Position',[Nx*xbuf  Ny*ybuf  s(3)-2*Nx*xbuf s(4)-2*Ny*ybuf]);
31   
32elseif a == 2 & b ==2
33    if c == 1
34        set(h, 'Position',[       xbuf    s(4)/2+.5*ybuf  s(3)/2-1*xbuf s(4)/2-2*ybuf]);
35    elseif c == 2
36        set(h, 'Position',[s(3)/2+xbuf/2  s(4)/2+.5*ybuf  s(3)/2-1*xbuf s(4)/2-2*ybuf]);
37    elseif c == 3
38        set(h, 'Position',[       xbuf              ybuf   s(3)/2-1*xbuf s(4)/2-2*ybuf]);
39    elseif c == 4
40        set(h, 'Position',[s(3)/2+xbuf/2            ybuf   s(3)/2-1*xbuf s(4)/2-2*ybuf]);
41    end
42elseif a == 1 & b ==2
43    if c == 1
44        set(h, 'Position',[       xbuf    Ny*ybuf  s(3)/2-1*xbuf s(4)-2*Ny*ybuf]);
45    elseif c == 2
46        set(h, 'Position',[s(3)/2+xbuf/2  Ny*ybuf  s(3)/2-1*xbuf s(4)-2*Ny*ybuf]);
47    elseif c == 3
48        set(h, 'Position',[       xbuf    Ny*ybuf  s(3)/2-1*xbuf s(4)-2*Ny*ybuf]);
49    elseif c == 4
50        set(h, 'Position',[s(3)/2+xbuf/2  Ny*ybuf  s(3)/2-1*xbuf s(4)-2*Ny*ybuf]);
51    end
52end
53
54set(h,'Units', FigUnits);
55
Note: See TracBrowser for help on using the repository browser.