Changeset 27292


Ignore:
Timestamp:
09/26/22 05:15:59 (3 years ago)
Author:
Mathieu Morlighem
Message:

BUG: fixing Inwoo's commit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/plot/plotmodel.m

    r27291 r27292  
    1010
    1111%get number of subplots
    12 subplotwidth=ceil(sqrt(options.numberofplots));
     12subplotwidth=ceil(sqrt(numberofplots));
    1313
    1414%if nlines and ncols specified, then bypass.
     
    2424
    2525%check that nlines and ncols were given at the same time!
    26 if ((exist(options.list{1},'ncols') & ~exist(options.list{1},'ncols')) | (~exist(options.list{1},'ncols') & exist(options.list{1},'nicols')))
     26if ((exist(options.list{1},'ncols') & ~exist(options.list{1},'ncols')) | (~exist(options.list{1},'ncols') & exist(options.list{1},'ncols')))
    2727        error('plotmodel error message: nlines and ncols  need to be specified together, or not at all');
     28end
     29
     30% Add option for subplot, only support one subplot per one plotmodel call
     31subindex = 0;
     32if (exist(options.list{1},'subplot'))
     33    subops = getfieldvalue(options.list{1},'subplot',NaN);
     34    nlines = subops(1);
     35    ncols = subops(2);
     36    subindex = subops(3);
     37    % change the width
     38    subplotwidth = ncols;
     39    % Turn off new figure option for subplot
     40    options.list{1}=addfield(options.list{1},'figurestatement','off');
     41    % Turn off clf option for subplot
     42    options.list{1}=addfield(options.list{1},'clf','off');
    2843end
    2944
     
    3247
    3348        %Create figure
    34         if strcmpi(getfieldvalue(options.list{1},'figurestatement','on'),'on'),
     49        if (strcmpi(getfieldvalue(options.list{1},'figurestatement','on'),'on'))
    3550                f=figure(figurenumber);
    3651        else
     
    86101                else
    87102                        set(gcf,'Position',figposition);
    88         end
    89    elseif strcmpi(getenv('USER'),'inwoo')
    90         set(gcf,'Position',[910 242 560 420]);
     103                end
     104        elseif strcmpi(getenv('USER'),'inwoo')
     105                set(gcf,'Position',[910 242 560 420]);
    91106        end % }}}
    92107
    93         %Use zbuffer renderer (snoother colors) and white background
     108        %Use zbuffer renderer (smoother colors) and white background
    94109        set(f,'Renderer','zbuffer','color',getfieldvalue(options.list{1},'figurebackgroundcolor','w'));
    95110
     
    97112        try,
    98113                for i=1:numberofplots,
    99                         plot_manager(getfieldvalue(options.list{i},'model',md),options.list{i},subplotwidth,nlines,ncols,i);
    100                         %List all unused options
     114            if subindex
     115                plot_manager(getfieldvalue(options.list{i},'model',md),options.list{i},subplotwidth,nlines,ncols,subindex);
     116            else
     117                plot_manager(getfieldvalue(options.list{i},'model',md),options.list{i},subplotwidth,nlines,ncols,i);
     118            end
     119            %List all unused options
    101120                        if getfieldvalue(options.list{i},'displayunused',1),
    102121                                displayunused(options.list{i})
     
    108127        end
    109128else
    110         error('plotmodel error message: no output data found. ');
     129        error('plotmodel error message: no output data found.');
    111130end
Note: See TracChangeset for help on using the changeset viewer.