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

Last change on this file was 21759, checked in by Eric.Larour, 8 years ago

CHG: merged branch back to trunk-jpl 21754.

File size: 3.6 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%go through subplots
32if numberofplots,
33
34 %Create figure
35 if strcmpi(getfieldvalue(options.list{1},'figurestatement','on'),'on'),
36 f=figure(figurenumber);
37 else
38 f=gcf;
39 end
40 if strcmpi(getfieldvalue(options.list{1},'clf','on'),'on'),
41 clf;
42 end
43 if strcmpi(getfieldvalue(options.list{1},'visible','on'),'off'),
44 set(f,'Visible','Off');
45 end
46
47 if exist(options.list{1},'figposition'), % {{{
48 figposition=getfieldvalue(options.list{1},'figposition');
49 if ischar(figposition),
50 if strcmpi(figposition,'larour'),
51 set(gcf,'Position',[1604 4 1594 1177]);
52 elseif strcmpi(figposition,'larour2'),
53 set(gcf,'Position',[756 62 827 504]);
54 elseif strcmpi(figposition,'mathieu'),
55 set(gcf,'Position',[300 1 1580 1150]);
56 elseif strcmpi(figposition,'fullscreen'),
57 set(gcf,'Position',get(0,'ScreenSize'));
58 elseif strcmpi(figposition,'halfright'),
59 screen=get(0,'ScreenSize');
60 left=screen(1); bott=screen(2); widt=screen(3); heig=screen(4)-25;
61 set(gcf,'Position',fix([left+widt/2 bott widt/2 heig]));
62 elseif strcmpi(figposition,'halfleft'),
63 screen=get(0,'ScreenSize');
64 left=screen(1); bott=screen(2); widt=screen(3); heig=screen(4)-25;
65 set(gcf,'Position',fix([left bott widt/2 heig]));
66 elseif strcmpi(figposition,'square'),
67 screen=get(0,'ScreenSize');
68 left=screen(1); bott=screen(2); widt=min(screen(3)-25,screen(4)-25);
69 set(gcf,'Position',fix([left+(screen(3)-widt) bott widt widt]));
70 elseif strcmpi(figposition,'portrait'),
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 portrait=fix([left+widt-(heig*8.5/11) bott heig*8.5/11 heig]);
75 set(gcf,'Position',portrait)
76 elseif strcmpi(figposition,'landscape'),
77 %reformat with letter paper size (8.5" x 11")
78 screen=get(0,'ScreenSize');
79 left=screen(1); bott=screen(2); widt=screen(3); heig=screen(4)-25;
80 landscape=fix([left+widt-(heig*11/8.5) bott heig*11/8.5 heig]);
81 set(gcf,'Position',landscape)
82 else
83 disp('''figposition'' string not supported yet');
84 end
85 else
86 set(gcf,'Position',figposition);
87 end
88 end % }}}
89
90 %Use zbuffer renderer (snoother colors) and white background
91 set(f,'Renderer','zbuffer','color',getfieldvalue(options.list{1},'figurebackgroundcolor','w'));
92
93 %Go through all data plottable and close window if an error occurs
94 try,
95 for i=1:numberofplots,
96 plot_manager(getfieldvalue(options.list{i},'model',md),options.list{i},subplotwidth,nlines,ncols,i);
97 %List all unused options
98 if getfieldvalue(options.list{i},'displayunused',1),
99 displayunused(options.list{i})
100 end
101 end
102 catch me,
103 %figure(figurenumber),close;
104 rethrow(me);
105 end
106else
107 error('plotmodel error message: no output data found. ');
108end
Note: See TracBrowser for help on using the repository browser.