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