This is a static copy of a profile report

Home

getLegendableChildren (Calls: 8, Time: 0.062 s)
Generated 16-Jul-2020 17:08:35 using performance time.
function in file /Applications/MATLAB_R2020a.app/toolbox/matlab/graphics/illustration/+matlab/+graphics/+illustration/+internal/getLegendableChildren.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
legend>getLegendableChildrensubfunction8
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
38
legkids = legkids(matlab.graph...
80.029 s47.2%
41
legkids = matlab.graphics.illu...
80.012 s20.3%
10
legkids = allchild(ax);
80.011 s17.5%
46
ch = flipud(legkids);
80.007 s11.3%
17
if matlab.graphics.illustratio...
80.001 s2.4%
All other lines  0.001 s1.3%
Totals  0.062 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
islegendablefunction80.027 s44.1%
expandLegendChildrenfunction80.012 s19.3%
allchildfunction80.010 s16.7%
flipudfunction80.006 s10.4%
isplotyyaxesfunction80.001 s1.6%
Self time (built-ins, overhead, etc.)  0.005 s7.8%
Totals  0.062 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function46
Non-code lines (comments, blank lines)26
Code lines (lines that can run)20
Code lines that did run10
Code lines that did not run10
Coverage (did run/can run)50.00 %
Function listing
time 
Calls 
 line
   1 
function ch=getLegendableChildren(ax,N)
   2 
%GET_LEGENDABLE_CHILDREN Gets the children for a legend
   3 
%  CH=GET_LEGENDABLE_CHILDREN(AX,N) returns the
   4 
%  legendable children for axes AX. 
   5 
%  N - is the threshold for the number of axes children to be returned.
   6 
%  If N is not provided than all the axes children will be tested for being legendable   
   7 

   8 
% Copyright 2004-2019 The MathWorks, Inc.
   9 

  0.011 
      8 
  10
legkids = allchild(ax); 
  11 

< 0.001 
      8 
  12
if nargin > 1 
  13 
    legkids(N:end) = [];
< 0.001 
      8 
  14
end 
  15 

  16 
% Take plotyy axes into account:
  0.001 
      8 
  17
if matlab.graphics.illustration.internal.isplotyyaxes(ax) 
  18 
    newAx = getappdata(ax,'graphicsPlotyyPeer');
  19 
    newChil = get(newAx,'Children');
  20 
    % The children of the axes of interest (passed in) should
  21 
    % appear lower in the stack than those of its plotyy peer.
  22 
    % The child stack gets flipud at the end of this function in
  23 
    % order to return a list in creation order.
  24 
    if ~isempty(newChil)
  25 
        legkids = [newChil(:); legkids(:)];
  26 
    else
  27 
        legkids = legkids(:);
  28 
    end            
  29 

< 0.001 
      8 
  30
end 
  31 

< 0.001 
      8 
  32
if isempty(legkids) 
  33 
    ch = matlab.graphics.primitive.Data.empty;
  34 
    return
< 0.001 
      8 
  35
end 
  36 

  37 
% exclude non-legendable objects
  0.029 
      8 
  38
legkids = legkids(matlab.graphics.illustration.internal.islegendable(legkids)); 
  39 

  40 
% support for hggroup
  0.012 
      8 
  41
legkids = matlab.graphics.illustration.internal.expandLegendChildren(legkids); 
  42 

  43 
% We need to return a list of legendable children in creation order, but
  44 
% the axes 'Children' property returns a stack (reverse creation order).
  45 
% So we flip it.
  0.007 
      8 
  46
ch = flipud(legkids); 

Other subfunctions in this file are not included in this listing.