Changeset 2562


Ignore:
Timestamp:
10/29/09 15:39:58 (15 years ago)
Author:
Mathieu Morlighem
Message:

changed the way plot_transient_field works: do not eval(string), create the subplot directly

Location:
issm/trunk/src/m/classes/public/plot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/classes/public/plot/plot_section.m

    r2559 r2562  
    172172
    173173%apply options
    174 if ~exist(options,'title'),
    175         options=addfielddefault(options,'title','Section value');
    176 end
     174options=addfielddefault(options,'title','Section value');
    177175if strcmpi(md.type,'2d')
    178176        options=addfielddefault(options,'colorbar',0);
  • issm/trunk/src/m/classes/public/plot/plot_transient_field.m

    r2488 r2562  
    1212end
    1313
    14 fontsize  =getfieldvalue(options,'fontsize',14);
    15 fontweight=getfieldvalue(options,'fontweight','n');
    16 figurenum =getfieldvalue(options,'figure',1);
    17 
    1814%Figure out the iterations to plot and check if it is possible
    1915steps=getfieldvalueerr(options,'steps');
     
    2218        error(['plot_transient_field error message: problem with the steps requested, must be an interger between 0 and ' num2str(maxiteration)]);
    2319end
     20subplotwidth=ceil(sqrt(length(steps)));
    2421
    2522%Figure out the field to plot
     
    4643end
    4744
    48 string='plotmodel(md';
     45%process mes only once
     46[x y z elements is2d]=processmesh(md,options);
     47
     48%plot data for all steps
    4949for i=1:length(steps),
    50         string=[string ',''data'',md.results.transient(' num2str(steps(i)) ').' field  ',''title'',''' field ' at time ' num2str(md.results.transient(steps(i)).time) ' a'''];
     50
     51        %process data and change title if needed
     52        [data isongrid isquiver]=processdata(md,md.results.transient(steps(i)).(field),options);
     53        options=addfielddefault(options,'title',[field ' at time ' num2str(md.results.transient(steps(i)).time) ' a']);
     54
     55        %create plot of step i
     56        subplot(subplotwidth,subplotwidth,i);
     57        plot_unit(x,y,z,elements,data,isongrid,is2d,isquiver,options)
     58
    5159end
    52 string=[string ',''colorbar#all'',''on'',''fontsize'',' num2str(fontsize) ',''fontweight'',''' fontweight ''',''figure'',' num2str(figurenum)];
    53 
    54 %Add options
    55 if exist(options,'caxis'),
    56         caxis_opt=getfieldvalue(options,'caxis',[]);
    57         string=[string ',''caxis#all'',[' num2str(caxis_opt(1)) ',' num2str(caxis_opt(2)) ']'];
    58 end
    59 
    60 %Execute string
    61 string=[string ');'];
    62 eval(string);
    63 clear string;
Note: See TracChangeset for help on using the changeset viewer.