source: issm/branches/trunk-larour-NatGeoScience2016/src/m/plot/plotmodel.m@ 21243

Last change on this file since 21243 was 14401, checked in by cborstad, 12 years ago

CHG: better default calculation for nlines

File size: 3.4 KB
Line 
1function plotmodel(md,varargin)
2%At command prompt, type plotdoc for help on documentation.
3
4%First process options
5options=plotoptions(varargin{:});
6
7%get number of subplots
8subplotwidth=ceil(sqrt(options.numberofplots));
9
10%Get figure number and number of plots
11figurenumber=options.figurenumber;
12numberofplots=options.numberofplots;
13
14%if nlines and ncols specified, then bypass.
15if exist(options.list{1},'nlines'),
16 nlines=getfieldvalue(options.list{1},'nlines');
17else
18 nlines=ceil(numberofplots/subplotwidth);
19end
20
21if exist(options.list{1},'ncols'),
22 ncols=getfieldvalue(options.list{1},'ncols');
23else
24 ncols=subplotwidth;
25end
26
27%check that nlines and ncols were given at the same time!
28if ((exist(options.list{1},'ncols') & ~exist(options.list{1},'ncols')) | (~exist(options.list{1},'ncols') & exist(options.list{1},'ncols')))
29 error('plotmodel error message: nlines and ncols need to be specified together, or not at all');
30end
31
32%go through subplots
33if numberofplots,
34
35 %Create figure
36 f=figure(figurenumber);clf;
37 if strcmpi(getfieldvalue(options.list{1},'visible','on'),'off'),
38 set(f,'Visible','Off');
39 end
40
41 if exist(options.list{1},'figposition'), % {{{
42 figposition=getfieldvalue(options.list{1},'figposition');
43 if ischar(figposition),
44 if strcmpi(figposition,'larour'),
45 set(gcf,'Position',[1604 4 1594 1177]);
46 elseif strcmpi(figposition,'larour2'),
47 set(gcf,'Position',[756 62 827 504]);
48 elseif strcmpi(figposition,'mathieu'),
49 set(gcf,'Position',[300 1 1580 1150]);
50 elseif strcmpi(figposition,'fullscreen'),
51 set(gcf,'Position',get(0,'ScreenSize'));
52 elseif strcmpi(figposition,'halfright'),
53 screen=get(0,'ScreenSize');
54 left=screen(1); bott=screen(2); widt=screen(3); heig=screen(4)-25;
55 set(gcf,'Position',fix([left+widt/2 bott widt/2 heig]));
56 elseif strcmpi(figposition,'halfleft'),
57 screen=get(0,'ScreenSize');
58 left=screen(1); bott=screen(2); widt=screen(3); heig=screen(4)-25;
59 set(gcf,'Position',fix([left bott widt/2 heig]));
60 elseif strcmpi(figposition,'square'),
61 screen=get(0,'ScreenSize');
62 left=screen(1); bott=screen(2); widt=min(screen(3)-25,screen(4)-25);
63 set(gcf,'Position',fix([left+(screen(3)-widt) bott widt widt]));
64 elseif strcmpi(figposition,'portrait'),
65 %reformat with letter paper size (8.5" x 11")
66 screen=get(0,'ScreenSize');
67 left=screen(1); bott=screen(2); widt=screen(3); heig=screen(4)-25;
68 portrait=fix([left+widt-(heig*8.5/11) bott heig*8.5/11 heig]);
69 set(gcf,'Position',portrait)
70 elseif strcmpi(figposition,'landscape'),
71 %reformat with letter paper size (8.5" x 11")
72 screen=get(0,'ScreenSize');
73 left=screen(1); bott=screen(2); widt=screen(3); heig=screen(4)-25;
74 landscape=fix([left+widt-(heig*11/8.5) bott heig*11/8.5 heig]);
75 set(gcf,'Position',landscape)
76 else
77 disp('''figposition'' string not supported yet');
78 end
79 else
80 set(gcf,'Position',figposition);
81 end
82 end % }}}
83
84 %Use zbuffer renderer (snoother colors) and white background
85 set(f,'Renderer','zbuffer','color',getfieldvalue(options.list{1},'figurebackgroundcolor','w'));
86
87 %Go through all data plottable and close window if an error occurs
88 try,
89 for i=1:numberofplots,
90 plot_manager(getfieldvalue(options.list{i},'model',md),options.list{i},subplotwidth,nlines,ncols,i);
91 %List all unused options
92 displayunused(options.list{i})
93 end
94 catch me,
95 %figure(figurenumber),close;
96 rethrow(me);
97 end
98else
99 error('plotmodel error message: no output data found. ');
100end
Note: See TracBrowser for help on using the repository browser.