Changeset 729 for trunk/src/plot_field.m
 Timestamp:
 Mar 4, 2014, 10:21:08 PM (10 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/plot_field.m
r690 r729 406 406 end 407 407 end 408 MinX(icell)=min(coord_x{icell}); 409 MaxX(icell)=max(coord_x{icell}); 410 testplot(coord_x_index)=0; 411 if isfield(CellInfo{icell},'VarIndex_ancillary') 412 testplot(CellInfo{icell}.VarIndex_ancillary)=0; 413 end 414 if isfield(CellInfo{icell},'VarIndex_warnflag') 415 testplot(CellInfo{icell}.VarIndex_warnflag)=0; 416 end 417 if isfield(data,'VarAttribute') 418 VarAttribute=data.VarAttribute; 408 if ~isempty(coord_x{icell}) 409 MinX(icell)=min(coord_x{icell}); 410 MaxX(icell)=max(coord_x{icell}); 411 testplot(coord_x_index)=0; 412 if isfield(CellInfo{icell},'VarIndex_ancillary') 413 testplot(CellInfo{icell}.VarIndex_ancillary)=0; 414 end 415 if isfield(CellInfo{icell},'VarIndex_warnflag') 416 testplot(CellInfo{icell}.VarIndex_warnflag)=0; 417 end 418 if isfield(data,'VarAttribute') 419 VarAttribute=data.VarAttribute; 420 for ivar=1:length(VarIndex) 421 if length(VarAttribute)>=VarIndex(ivar) && isfield(VarAttribute{VarIndex(ivar)},'long_name') 422 plotname{VarIndex(ivar)}=VarAttribute{VarIndex(ivar)}.long_name; 423 else 424 plotname{VarIndex(ivar)}=data.ListVarName{VarIndex(ivar)};%name for display in plot A METTRE 425 end 426 end 427 end 428 if isfield(CellInfo{icell},'VarIndex_discrete') 429 charplot_0='''+'''; 430 else 431 charplot_0=''''''; 432 end 433 MinY=[]; 434 MaxY=[];%default 435 436 nbplot=0; 419 437 for ivar=1:length(VarIndex) 420 if length(VarAttribute)>=VarIndex(ivar) && isfield(VarAttribute{VarIndex(ivar)},'long_name') 421 plotname{VarIndex(ivar)}=VarAttribute{VarIndex(ivar)}.long_name; 422 else 423 plotname{VarIndex(ivar)}=data.ListVarName{VarIndex(ivar)};%name for display in plot A METTRE 424 end 425 end 426 end 427 if isfield(CellInfo{icell},'VarIndex_discrete') 428 charplot_0='''+'''; 429 else 430 charplot_0=''''''; 431 end 432 MinY=[]; 433 MaxY=[];%default 434 435 nbplot=0; 436 for ivar=1:length(VarIndex) 437 if testplot(VarIndex(ivar)) 438 VarName=data.ListVarName{VarIndex(ivar)}; 439 nbplot=nbplot+1; 440 ytitle=[ytitle VarName]; 441 if isfield(data,'VarAttribute')&& numel(data.VarAttribute)>=VarIndex(ivar) && isfield(data.VarAttribute{VarIndex(ivar)},'units') 442 ytitle=[ytitle '(' data.VarAttribute{VarIndex(ivar)}.units '), ']; 443 else 444 ytitle=[ytitle ', ']; 445 end 446 eval(['data.' VarName '=squeeze(data.' VarName ');']) 447 MinY(ivar)=min(min(data.(VarName))); 448 MaxY(ivar)=max(max(data.(VarName))); 449 plotstr=[plotstr 'coord_x{' num2str(icell) '},data.' VarName ',' charplot_0 ',']; 450 eval(['nbcomponent2=size(data.' VarName ',2);']); 451 eval(['nbcomponent1=size(data.' VarName ',1);']); 452 if numel(coord_x{icell})==2 453 coord_x{icell}=linspace(coord_x{icell}(1),coord_x{icell}(2),nbcomponent1); 454 end 455 if nbcomponent1==1 nbcomponent2==1 456 legend_str=[legend_str {VarName}]; %variable with one component 457 else %variable with severals components 458 for ic=1:min(nbcomponent1,nbcomponent2) 459 legend_str=[legend_str [VarName '_' num2str(ic)]]; %variable with severals components 460 end % labeled by their index (e.g. color component) 461 end 462 end 463 end 464 if ~isempty(MinY) 465 MinY_cell(icell)=min(MinY); 466 MaxY_cell(icell)=max(MaxY); 438 if testplot(VarIndex(ivar)) 439 VarName=data.ListVarName{VarIndex(ivar)}; 440 nbplot=nbplot+1; 441 ytitle=[ytitle VarName]; 442 if isfield(data,'VarAttribute')&& numel(data.VarAttribute)>=VarIndex(ivar) && isfield(data.VarAttribute{VarIndex(ivar)},'units') 443 ytitle=[ytitle '(' data.VarAttribute{VarIndex(ivar)}.units '), ']; 444 else 445 ytitle=[ytitle ', ']; 446 end 447 eval(['data.' VarName '=squeeze(data.' VarName ');']) 448 MinY(ivar)=min(min(data.(VarName))); 449 MaxY(ivar)=max(max(data.(VarName))); 450 plotstr=[plotstr 'coord_x{' num2str(icell) '},data.' VarName ',' charplot_0 ',']; 451 eval(['nbcomponent2=size(data.' VarName ',2);']); 452 eval(['nbcomponent1=size(data.' VarName ',1);']); 453 if numel(coord_x{icell})==2 454 coord_x{icell}=linspace(coord_x{icell}(1),coord_x{icell}(2),nbcomponent1); 455 end 456 if nbcomponent1==1 nbcomponent2==1 457 legend_str=[legend_str {VarName}]; %variable with one component 458 else %variable with severals components 459 for ic=1:min(nbcomponent1,nbcomponent2) 460 legend_str=[legend_str [VarName '_' num2str(ic)]]; %variable with severals components 461 end % labeled by their index (e.g. color component) 462 end 463 end 464 end 465 if ~isempty(MinY) 466 MinY_cell(icell)=min(MinY); 467 MaxY_cell(icell)=max(MaxY); 468 end 467 469 end 468 470 end
Note: See TracChangeset
for help on using the changeset viewer.