Changeset 871 for trunk/src/plot_field.m


Ignore:
Timestamp:
Feb 16, 2015, 12:15:23 AM (6 years ago)
Author:
sommeria
Message:

histo improved

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plot_field.m

    r869 r871  
    202202    end       
    203203    PlotParamOut.Axes=plot_profile(Data,CellInfo(index_1D),haxes,PlotParamOut.Axes,CheckHold);%
     204    if isfield(PlotParamOut,'Vectors')
     205        PlotParamOut=rmfield(PlotParamOut,'Vectors');
     206    end
     207    if isfield(PlotParamOut,'Scalar')
     208        PlotParamOut=rmfield(PlotParamOut,'Scalar');
     209    end   
    204210    if testzoomaxes
    205211        [zoomaxes,PlotParamOut.Axes]=plot_profile(Data,CellInfo(index_1D),zoomaxes,PlotParamOut.Axes,CheckHold);
     
    216222htext=findobj(hfig,'Tag','TableDisplay');
    217223hchecktable=findobj(hfig,'Tag','CheckTable');
    218 % if isempty(index_2D) && isempty(index_1D)%text display alone
    219 %     htext=findobj(hfig,'Tag','TableDisplay');
    220 % else  %text display added to plot
    221 %     %htext=findobj(hfig,'Tag','text_display');
    222 % end
    223224if ~isempty(htext)&&~isempty(hchecktable)
    224225    if isempty(index_0D)
    225         set(htext,'Data',{})
    226         set(htext,'visible','off')
    227         set(hchecktable,'visible','off')
    228         set(hchecktable,'Value',0)
     226%         set(htext,'Data',{})
     227%         set(htext,'visible','off')
     228%         set(hchecktable,'visible','off')
     229%         set(hchecktable,'Value',0)
    229230    else
    230231        errormsg=plot_text(Data,CellInfo(index_0D),htext);
     
    384385ColorOrder=[1 0 0;0 1 0;0 0 1;0 0.75 0.75;0.75 0 0.75;0.75 0.75 0;0.25 0.25 0.25];
    385386set(hfig,'DefaultAxesColorOrder',ColorOrder)
    386 % if isfield(Coordinates,'NextPlot')
    387 %     set(haxes,'NextPlot',Coordinates.NextPlot)
    388 % end
    389387if CheckHold
    390388    set(haxes,'NextPlot','add')
     
    395393%% prepare the string for plot command
    396394plotstr='hhh=plot(';
    397 % coord_x_index=[];
    398395xtitle='';
    399396ytitle='';
     
    403400MinY_cell=[];
    404401MaxY_cell=[];
     402testplot=ones(size(data.ListVarName));%default test for plotted variables
    405403%loop on input  fields
    406404for icell=1:numel(CellInfo)
    407405    VarIndex=CellInfo{icell}.VarIndex;%  indices of the selected variables in the list data.ListVarName
    408406    coord_x_index=CellInfo{icell}.CoordIndex;
    409     testplot=ones(size(data.ListVarName));%default test for plotted variables
    410407    coord_x_name{icell}=data.ListVarName{coord_x_index};
    411408    coord_x{icell}=data.(data.ListVarName{coord_x_index});%coordinate variable set as coord_x
     
    573570end
    574571
     572%% give statistics for pdf
     573ind_var=find(testplot);
     574if numel(ind_var)==1 && isfield(data,'VarAttribute') && isfield(data.VarAttribute{ind_var},'Role') &&...
     575        strcmp(data.VarAttribute{ind_var}.Role,'histo')
     576    pdf_val=data.(data.ListVarName{ind_var});
     577    x=coord_x{1};
     578    TableData=cell(12,2);
     579    TableData(:,1)={'SampleNbr';'Mean';'RMS';'Skewness';'Kurtosis';...
     580        'Min';'FirstCentile';'FirstDecile';'Median';'LastDecile';'LastCentile';'Max'};
     581    Val=zeros(12,1);
     582    Val(1)=sum(pdf_val);% total sample number
     583    pdf_val=pdf_val/Val(1);% normalised pdf
     584    Val(2)=sum(x.*pdf_val);%Mean
     585    x=x-Val(2); %centered variable
     586    Variance=sum(x.*x.*pdf_val);
     587    Val(3)=sqrt(Variance);
     588    Val(4)=(sum(x.*x.*x.*pdf_val))/(Variance*Val(3));%skewness
     589    Val(5)=(sum(x.*x.*x.*x.*pdf_val))/(Variance*Variance);%kurtosis
     590    Val(6)=min(x);
     591    cumpdf=cumsum(pdf_val);
     592    ind_centile=find(cumpdf>=0.01,1);
     593    Val(7)=x(ind_centile);
     594    ind_decile=find(cumpdf>=0.1,1);
     595    Val(8)=x(ind_decile);
     596    ind_median=find(cumpdf>= 0.5,1);
     597    Val(9)=x(ind_median);
     598    ind_decile=find(cumpdf>=0.9,1);
     599    Val(10)=x(ind_decile);
     600    ind_centile=find(cumpdf>=0.99,1);
     601    Val(11)=x(ind_centile);
     602    Val(12)=max(x);   
     603    TableData(:,2)=mat2cell(Val,ones(12,1),1)
     604    TableData=[TableData(1:5,:);{'   -- centered','stat: --'};TableData(6:12,:)];
     605    htable=findobj(hfig,'Tag','TableDisplay')
     606    set(htable,'Data',TableData)
     607    set(htable,'Visible','on')
     608    drawnow
     609end
     610   
    575611%-------------------------------------------------------------------
    576612function [haxes,PlotParamOut,PlotType,errormsg]=plot_plane(Data,CellInfo,haxes,PlotParam)
Note: See TracChangeset for help on using the changeset viewer.