Changeset 25038


Ignore:
Timestamp:
06/16/20 09:31:08 (5 years ago)
Author:
Cheng Gong
Message:

NEW: add 'subplot' option in plotmodel. The value has to be 1x3 integer array as [nlines, ncols, subindex]. Example: plotmodel(md, 'data', md.results.StressbalanceSolution.Vx, 'subplot', [2,2,1]). This will override the subplot [2,2,1] of the current figure. An existing bug is when using this with special plots, such as 'mesh', 'BC', etc. It will not override the previous subplot if it exists.

Location:
issm/trunk-jpl/src/m/plot
Files:
2 edited

Legend:

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

    r24478 r25038  
    202202end
    203203
     204% clear subplot option
     205if exist(options,'subplot')
     206    cla;
     207end
     208
    204209%plot unit
    205210plot_unit(x,y,z,elements,data2,is2d,isplanet,datatype,options);
  • issm/trunk-jpl/src/m/plot/plotmodel.m

    r22927 r25038  
    2828end
    2929
     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');
     43end
     44
    3045%go through subplots
    3146if numberofplots,
    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
     
    95110        try,
    96111                for i=1:numberofplots,
    97                         plot_manager(getfieldvalue(options.list{i},'model',md),options.list{i},subplotwidth,nlines,ncols,i);
    98                         %List all unused options
     112            if subindex
     113                plot_manager(getfieldvalue(options.list{i},'model',md),options.list{i},subplotwidth,nlines,ncols,subindex);
     114            else
     115                plot_manager(getfieldvalue(options.list{i},'model',md),options.list{i},subplotwidth,nlines,ncols,i);
     116            end
     117            %List all unused options
    99118                        if getfieldvalue(options.list{i},'displayunused',1),
    100119                                displayunused(options.list{i})
Note: See TracChangeset for help on using the changeset viewer.