Changeset 874 for trunk/src/plot_field.m
- Timestamp:
- Feb 19, 2015, 2:17:59 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plot_field.m
r873 r874 201 201 CheckHold= PlotParam.CheckHold; 202 202 end 203 PlotParamOut .Axes=plot_profile(Data,CellInfo(index_1D),haxes,PlotParamOut.Axes,CheckHold);%203 PlotParamOut=plot_profile(Data,CellInfo(index_1D),haxes,PlotParamOut,CheckHold);% 204 204 if isempty(index_2D) 205 205 if isfield(PlotParamOut,'Vectors') … … 224 224 if ~(isfield(PlotParamOut,'Axes')&&isfield(PlotParamOut.Axes,'TextDisplay')&&(PlotParamOut.Axes.TextDisplay)) % if text is not already given as statistics 225 225 htext=findobj(hfig,'Tag','TableDisplay'); 226 hchecktable=findobj(hfig,'Tag','CheckTable');227 if ~isempty(htext) &&~isempty(hchecktable)226 % hchecktable=findobj(hfig,'Tag','CheckTable'); 227 if ~isempty(htext)%&&~isempty(hchecktable) 228 228 if isempty(index_0D) 229 229 % set(htext,'Data',{}) … … 234 234 errormsg=plot_text(Data,CellInfo(index_0D),htext); 235 235 set(htext,'visible','on') 236 set(hchecktable,'visible','on')237 set(hchecktable,'Value',1)236 % set(hchecktable,'visible','on') 237 % set(hchecktable,'Value',1) 238 238 end 239 239 set(hfig,'Unit','pixels'); … … 261 261 %% update the parameters stored in AxeData 262 262 if ishandle(haxes)&&( ~isempty(index_2D)|| ~isempty(index_1D)) 263 % AxeData=[];264 263 if isfield(PlotParamOut,'MinX') 265 264 AxeData.RangeX=[PlotParamOut.MinX PlotParamOut.MaxX]; … … 362 361 % --- plot 1D fields (usual x,y plots) 363 362 %------------------------------------------------------------------- 364 function CoordinatesOut=plot_profile(data,CellInfo,haxes,Coordinates,CheckHold)363 function PlotParamOut=plot_profile(data,CellInfo,haxes,PlotParam,CheckHold) 365 364 366 365 %% initialization 367 if ~ exist('Coordinates','var')366 if ~(exist('PlotParam','var')&&~isempty(PlotParam.Axes)) 368 367 Coordinates=[]; 369 end 370 CoordinatesOut=Coordinates; %default 368 PlotParamOut.Axes=Coordinates; 369 else 370 Coordinates=PlotParam.Axes; 371 PlotParamOut=PlotParam; 372 end 371 373 hfig=get(haxes,'parent'); 372 374 legend_str={}; … … 545 547 if ~isempty(MinX) 546 548 if check_lim 547 Coordinates Out.MinX=min(min(MinX),CoordinatesOut.MinX);548 Coordinates Out.MaxX=max(max(MaxX),CoordinatesOut.MaxX);549 else 550 Coordinates Out.MinX=min(MinX);551 Coordinates Out.MaxX=max(MaxX);549 Coordinates.MinX=min(min(MinX),Coordinates.MinX); 550 Coordinates.MaxX=max(max(MaxX),Coordinates.MaxX); 551 else 552 Coordinates.MinX=min(MinX); 553 Coordinates.MaxX=max(MaxX); 552 554 end 553 555 end 554 556 if ~isempty(MinY_cell) 555 557 if check_lim 556 Coordinates Out.MinY=min(min(MinY_cell),CoordinatesOut.MinY);557 Coordinates Out.MaxY=max(max(MaxY_cell),CoordinatesOut.MaxY);558 else 559 Coordinates Out.MinY=min(MinY_cell);560 Coordinates Out.MaxY=max(MaxY_cell);558 Coordinates.MinY=min(min(MinY_cell),Coordinates.MinY); 559 Coordinates.MaxY=max(max(MaxY_cell),Coordinates.MaxY); 560 else 561 Coordinates.MinY=min(MinY_cell); 562 Coordinates.MaxY=max(MaxY_cell); 561 563 end 562 564 end … … 570 572 set(haxes,'DataAspectRatioMode','auto')%automatic aspect ratio 571 573 AspectRatio=get(haxes,'DataAspectRatio'); 572 CoordinatesOut.AspectRatio=AspectRatio(1)/AspectRatio(2); 573 end 574 Coordinates.AspectRatio=AspectRatio(1)/AspectRatio(2); 575 end 576 PlotParamOut.Axes= Coordinates; 574 577 575 578 %% give statistics for pdf … … 577 580 TableData={'Variable';'SampleNbr';'bin size';'Mean';'RMS';'Skewness';'Kurtosis';' centered ';... 578 581 'Min';'FirstCentile';'FirstDecile';'Median';'LastDecile';'LastCentile';'Max'}; 579 CoordinatesOut.TextDisplay=0; 582 %PlotParamOut.TableDisplay={}; 583 TextDisplay=0; 580 584 for icell=1:numel(CellInfo) 581 585 if isfield(CellInfo{icell},'VarIndex_histo') 582 586 check_stat=1; 583 CoordinatesOut.TextDisplay=1;587 TextDisplay=1; 584 588 VarName=data.ListVarName{CellInfo{icell}.CoordIndex}; 585 589 pdf_val=data.(data.ListVarName{CellInfo{icell}.VarIndex_histo}); … … 597 601 Val(5)=(sum(x.*x.*x.*pdf_val))/(Variance*Val(4));%skewness 598 602 Val(6)=(sum(x.*x.*x.*x.*pdf_val))/(Variance*Variance);%kurtosis 599 cumpdf=cumsum(pdf_val); 603 cumpdf=cumsum(pdf_val);% sum of pdf 600 604 ind_centile=find(cumpdf>=0.01,1);% first index with cumsum >=0.01 601 Val(8)=(cumpdf(ind_centile)-0.01)*x(ind_centile-1)+(0.01-cumpdf(ind_centile-1))*x(ind_centile); 602 Val(8)=Val(8)/(cumpdf(ind_centile)-cumpdf(ind_centile-1));%linear interpolation near ind_centile 605 Val(8)=x(ind_centile)+Val(2)/2;% 606 if ind_centile>1 607 Val(8)=(cumpdf(ind_centile)-0.01)*x(ind_centile-1)+(0.01-cumpdf(ind_centile-1))*x(ind_centile); 608 Val(8)=Val(8)/(cumpdf(ind_centile)-cumpdf(ind_centile-1))+Val(2)/2;%linear interpolation near ind_centile 609 end 603 610 ind_decile=find(cumpdf>=0.1,1); 604 Val(9)=(cumpdf(ind_decile)-0.1)*x(ind_decile-1)+(0.1-cumpdf(ind_decile-1))*x(ind_decile); 605 Val(9)=Val(9)/(cumpdf(ind_decile)-cumpdf(ind_decile-1));%linear interpolation near ind_decile; 611 if ind_decile>1 612 Val(9)=x(ind_decile)+Val(2)/2;% 613 Val(9)=(cumpdf(ind_decile)-0.1)*x(ind_decile-1)+(0.1-cumpdf(ind_decile-1))*x(ind_decile); 614 Val(9)=Val(9)/(cumpdf(ind_decile)-cumpdf(ind_decile-1))+Val(2)/2;%linear interpolation near ind_decile; 615 end 606 616 ind_median=find(cumpdf>= 0.5,1); 607 617 Val(10)=(cumpdf(ind_median)-0.5)*x(ind_median-1)+(0.5-cumpdf(ind_median-1))*x(ind_median); 608 Val(10)=Val(10)/(cumpdf(ind_median)-cumpdf(ind_median-1)) ;%linear interpolation near ind_median;618 Val(10)=Val(10)/(cumpdf(ind_median)-cumpdf(ind_median-1))+Val(2)/2;%linear interpolation near ind_median; 609 619 % Val(9)=x(ind_median); 610 620 ind_decile=find(cumpdf>=0.9,1); 611 621 Val(11)=(cumpdf(ind_decile)-0.9)*x(ind_decile-1)+(0.9-cumpdf(ind_decile-1))*x(ind_decile); 612 Val(11)=Val(11)/(cumpdf(ind_decile)-cumpdf(ind_decile-1)) ;%linear interpolation near ind_median;622 Val(11)=Val(11)/(cumpdf(ind_decile)-cumpdf(ind_decile-1))+Val(2)/2;%linear interpolation near ind_median; 613 623 ind_centile=find(cumpdf>=0.99,1); 614 624 Val(12)=(cumpdf(ind_centile)-0.99)*x(ind_centile-1)+(0.99-cumpdf(ind_centile-1))*x(ind_centile); 615 Val(12)=Val(12)/(cumpdf(ind_centile)-cumpdf(ind_centile-1));%linear interpolation near ind_centile; 616 Val(13)=max(x); 625 Val(12)=Val(12)/(cumpdf(ind_centile)-cumpdf(ind_centile-1))+Val(2)/2;%linear interpolation near ind_centile; 617 626 Column=mat2cell(Val,ones(13,1),1); 618 627 Column=[{VarName};Column(1:6);{'stat: --'};Column(7:13)]; … … 620 629 end 621 630 end 622 if CoordinatesOut.TextDisplay;631 if TextDisplay; 623 632 disp(TableData); 624 htable=findobj(hfig,'Tag','TableDisplay'); 625 set(htable,'Data',TableData) 626 set(htable,'Visible','on') 627 drawnow 633 PlotParamOut.TableDisplay=TableData; 634 % PlotParamOut.CheckTable=1; 635 % htable=findobj(hfig,'Tag','TableDisplay'); 636 % set(htable,'Data',TableData) 637 % set(htable,'Visible','on') 638 % drawnow 639 else 640 if isfield(PlotParamOut,'TableDisplay') 641 PlotParamOut=rmfield(PlotParamOut,'TableDisplay'); 642 end 628 643 end 629 644
Note: See TracChangeset
for help on using the changeset viewer.