This is a static copy of a profile report

Home

legendcolorbarlayout (68 calls, 0.700 sec)
Generated 05-Aug-2011 13:00:45 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/scribe/legendcolorbarlayout.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
scribe.legend.initfunction42
graphics/private/clofunction9
subplotfunction1
scribe.legend.init>legendDeletedsubfunction12
closereqfunction4
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
120
doBestLegendLayout(ax,h);
90.503 s71.9%
34
doLayout(double(ax));
200.120 s17.2%
39
list = createListeners(ax);
140.022 s3.1%
98
if isempty(ax) || ~ishandle(ax...
140.011 s1.6%
73
if isempty(ax) || ~ishandle(ax...
60.011 s1.6%
All other lines  0.033 s4.7%
Totals  0.700 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
legendcolorbarlayout>doBestLegendLayoutsubfunction90.503 s71.9%
legendcolorbarlayout>doLayoutsubfunction200.120 s17.2%
legendcolorbarlayout>createListenerssubfunction140.022 s3.1%
legendcolorbarlayout>getListenerssubfunction480.022 s3.1%
legendcolorbarlayout>rmListenerssubfunction140.011 s1.6%
fliplrfunction140 s0%
Self time (built-ins, overhead, etc.)  0.022 s3.1%
Totals  0.700 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function146
Non-code lines (comments, blank lines)44
Code lines (lines that can run)102
Code lines that did run47
Code lines that did not run55
Coverage (did run/can run)46.08 %
Function listing
   time   calls  line
1 function legendcolorbarlayout(ax,action,varargin)
2 %LEGENDCOLORBARLAYOUT Layout legend and/or colorbar around axes
3 % This is a helper function for legend and colorbar. Do not call
4 % directly.
5
6 % LEGENDCOLORBARLAYOUT(AX,'layout') lays out any
7 % legends and colorbars around axes AX
8 % LEGENDCOLORBARLAYOUT(AX,'on') turns on the listeners for laying
9 % out legends and colorbars for axes AX.
10 % LEGENDCOLORBARLAYOUT(AX,'off') turns off the listeners.
11 % LEGENDCOLORBARLAYOUT(AX,'remove') deletes the listeners.
12 % LEGENDCOLORBARLAYOUT(AX,'addToLayoutList',h) adds h to layout
13 % list. Does not perform a layout afterwards.
14 % LEGENDCOLORBARLAYOUT(AX,'removeFromLayoutList',h) removes h
15 % from layout list. Does not perform a layout afterwards.
16 % LEGENDCOLORBARLAYOUT(AX,'objectChanged',h) update layout
17 % because of h.
18 % LEGENDCOLORBARLAYOUT(AX,'resetOuterLayout') resets the position
19 % of AX to fill where the outside legends and colorbars were.
20 % LEGENDCOLORBARLAYOUT(AX,'resetOuterLayout','force') forces
21 % the outer layout to reset even if the layout listeners don't exist
22 % LEGENDCOLORBARLAYOUT(AX,'layoutNoPixelBounds')
23
24 % Copyright 1984-2009 The MathWorks, Inc.
25
68 26 if feature('HGUsingMATLABClasses')
27 legendcolorbarlayoutHGUsingMATLABClasses(ax,action,varargin{:});
28 return;
29 end
30
68 31 switch(action)
32
68 33 case 'layout'
0.12 20 34 doLayout(double(ax));
35
48 36 case 'on'
14 37 list = getListeners(ax);
14 38 if isempty(list)
0.02 14 39 list = createListeners(ax);
14 40 end
14 41 set(list,'enable','on');
42
34 43 case 'off'
44 list = getListeners(ax);
45 if ~isempty(list)
46 set(list,'enable','on');
47 end
48
34 49 case 'remove'
14 50 if ~isempty(getListeners(ax))
0.01 14 51 rmListeners(ax);
14 52 end
53
20 54 case 'objectChanged' % called when one object in the layout changes size
55 h = varargin{1};
56 location = get(h,'Location');
57 if strncmp(fliplr(location),'edistuO',7) % match 'FooOutside'
58 legendcolorbarlayout(ax,'resetOuterLayout');
59 elseif isa(handle(h),'scribe.legend') && any(strcmp(location,{'Best','none'}))
60 h = handle(h);
61 if strcmp(location,'none')
62 resizeManualLegend(h);
63 else
64 doBestLegendLayout(ax,h);
65 end
66 return;
67 end
68
69 doLayout(ax);
70
20 71 case 'removeFromLayoutList'
6 72 h = varargin{1};
0.01 6 73 if isempty(ax) || ~ishandle(ax) || ...
74 isempty(h) || ~ishandle(h) || ...
75 isempty(getListeners(ax))
76 if ishandle(ax) % TODO: really needed? hgload
77 reclaimSpace(ax,[]);
78 end
79 return;
80 end
6 81 hax = handle(ax);
82
6 83 list = getappdata(ax,'LegendColorbarOuterList');
6 84 list(~ishandle(list)) = [];
6 85 isouter = list == handle(h);
6 86 if any(isouter)
87 list(isouter) = [];
88 reclaimSpace(ax,list);
89 end
6 90 setappdata(hax,'LegendColorbarOuterList',list)
6 91 list2 = getappdata(ax,'LegendColorbarInnerList');
6 92 list2(~ishandle(list2)) = [];
6 93 list2(list2 == handle(h)) = [];
6 94 setappdata(hax,'LegendColorbarInnerList',list2)
95
14 96 case 'addToLayoutList'
14 97 h = varargin{1};
0.01 14 98 if isempty(ax) || ~ishandle(ax) || ...
99 isempty(h) || ~ishandle(h) || ...
100 isempty(getListeners(ax))
101 return;
102 end
14 103 hax = handle(ax);
104
14 105 hh = handle(h);
14 106 location = get(h,'Location');
14 107 if strcmp(location,'BestOutside')
108 location = calculate_best_outside(h);
109 end
14 110 if strncmp(fliplr(location),'edistuO',7)
111 list = getappdata(ax,'LegendColorbarOuterList');
112 list(~ishandle(list)) = [];
113 if any(list == hh), return; end
114 if isempty(list), initInsetAppdata(ax); end
115 list = [hh;list];
116 setappdata(hax,'LegendColorbarOuterList',list)
117 makeSpace(ax,hh,location);
14 118 elseif ~strcmp(location,'none') && ~strcmp(location,'manual')
14 119 if strcmp(location,'Best')
0.50 9 120 doBestLegendLayout(ax,h);
9 121 end
14 122 list = getappdata(ax,'LegendColorbarInnerList');
14 123 list(~ishandle(list)) = [];
14 124 if any(list == hh), return; end
14 125 list = [hh;list];
14 126 setappdata(hax,'LegendColorbarInnerList',list)
14 127 end
128
129 case 'resetOuterLayout'
130 if isempty(ax) || ~ishandle(ax) || ...
131 isempty(getListeners(ax))
132 if nargin > 2 && ishandle(ax) && strcmp(varargin{1},'force')
133 reclaimSpace(ax,[]);
134 end
135 return;
136 end
137 list = getappdata(ax,'LegendColorbarOuterList');
138 list(~ishandle(list)) = [];
139 if ~isempty(list)
140 reclaimSpace(ax,list);
141 end
142
143 case 'layoutNoPixelBounds'
144 doLayout(double(ax),false);
145
146 end

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