Changeset 22907


Ignore:
Timestamp:
07/06/18 15:49:50 (7 years ago)
Author:
Mathieu Morlighem
Message:

CHG: better computation of nrows and ncols if only one is provided

File:
1 edited

Legend:

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

    r21805 r22907  
    55options=plotoptions(varargin{:});
    66
    7 %get number of subplots
    8 subplotwidth=ceil(sqrt(options.numberofplots));
    9 
    107%Get figure number and number of plots
    118figurenumber=options.figurenumber;
    129numberofplots=options.numberofplots;
    1310
     11%get number of subplots
     12subplotwidth=ceil(sqrt(options.numberofplots));
     13
    1414%if nlines and ncols specified, then bypass.
    15 if exist(options.list{1},'nlines'),
    16         nlines=getfieldvalue(options.list{1},'nlines');
    17 else
    18         nlines=ceil(numberofplots/subplotwidth);
    19 end
    20 
    21 if exist(options.list{1},'ncols'),
    22         ncols=getfieldvalue(options.list{1},'ncols');
    23 else
    24         ncols=subplotwidth;
     15if ~exist(options.list{1},'nlines') & ~exist(options.list{1},'ncols')
     16         nlines=ceil(numberofplots/subplotwidth);
     17         ncols=subplotwidth;
     18else
     19        nlines=getfieldvalue(options.list{1},'nlines',NaN);
     20        ncols=getfieldvalue(options.list{1},'ncols',NaN);
     21        if isnan(nlines), nlines = ceil(numberofplots/ncols);  end
     22        if isnan(ncols),  ncols  = ceil(numberofplots/nlines); end
    2523end
    2624
Note: See TracChangeset for help on using the changeset viewer.