[1] | 1 | function plotmodel(md,varargin)
|
---|
| 2 | %At command prompt, type plotdoc for help on documentation.
|
---|
[27] | 3 |
|
---|
[2439] | 4 | %First process options
|
---|
| 5 | options=plotoptions(varargin{:});
|
---|
[1] | 6 |
|
---|
[2819] | 7 | %get number of subplots
|
---|
[2439] | 8 | subplotwidth=ceil(sqrt(options.numberofplots));
|
---|
[1] | 9 |
|
---|
[14401] | 10 | %Get figure number and number of plots
|
---|
| 11 | figurenumber=options.figurenumber;
|
---|
| 12 | numberofplots=options.numberofplots;
|
---|
| 13 |
|
---|
[2819] | 14 | %if nlines and ncols specified, then bypass.
|
---|
| 15 | if exist(options.list{1},'nlines'),
|
---|
| 16 | nlines=getfieldvalue(options.list{1},'nlines');
|
---|
| 17 | else
|
---|
[14401] | 18 | nlines=ceil(numberofplots/subplotwidth);
|
---|
[2819] | 19 | end
|
---|
| 20 |
|
---|
| 21 | if exist(options.list{1},'ncols'),
|
---|
| 22 | ncols=getfieldvalue(options.list{1},'ncols');
|
---|
| 23 | else
|
---|
| 24 | ncols=subplotwidth;
|
---|
| 25 | end
|
---|
| 26 |
|
---|
| 27 | %check that nlines and ncols were given at the same time!
|
---|
| 28 | if ((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');
|
---|
| 30 | end
|
---|
[1] | 31 | %go through subplots
|
---|
| 32 | if numberofplots,
|
---|
[13646] | 33 |
|
---|
[27] | 34 | %Create figure
|
---|
[21759] | 35 | if strcmpi(getfieldvalue(options.list{1},'figurestatement','on'),'on'),
|
---|
| 36 | f=figure(figurenumber);
|
---|
| 37 | else
|
---|
| 38 | f=gcf;
|
---|
| 39 | end
|
---|
[21365] | 40 | if strcmpi(getfieldvalue(options.list{1},'clf','on'),'on'),
|
---|
| 41 | clf;
|
---|
| 42 | end
|
---|
[3338] | 43 | if strcmpi(getfieldvalue(options.list{1},'visible','on'),'off'),
|
---|
[14300] | 44 | set(f,'Visible','Off');
|
---|
[3338] | 45 | end
|
---|
[1] | 46 |
|
---|
[14300] | 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 % }}}
|
---|
[2623] | 89 |
|
---|
[14300] | 90 | %Use zbuffer renderer (snoother colors) and white background
|
---|
| 91 | set(f,'Renderer','zbuffer','color',getfieldvalue(options.list{1},'figurebackgroundcolor','w'));
|
---|
| 92 |
|
---|
[6497] | 93 | %Go through all data plottable and close window if an error occurs
|
---|
| 94 | try,
|
---|
| 95 | for i=1:numberofplots,
|
---|
[7197] | 96 | plot_manager(getfieldvalue(options.list{i},'model',md),options.list{i},subplotwidth,nlines,ncols,i);
|
---|
[14177] | 97 | %List all unused options
|
---|
[21759] | 98 | if getfieldvalue(options.list{i},'displayunused',1),
|
---|
| 99 | displayunused(options.list{i})
|
---|
| 100 | end
|
---|
[6497] | 101 | end
|
---|
| 102 | catch me,
|
---|
[7824] | 103 | %figure(figurenumber),close;
|
---|
[6497] | 104 | rethrow(me);
|
---|
[1] | 105 | end
|
---|
| 106 | else
|
---|
| 107 | error('plotmodel error message: no output data found. ');
|
---|
| 108 | end
|
---|