This is a static copy of a profile report

Home

legendcolorbarlayout (3 calls, 0.079 sec)
Generated 28-Feb-2011 19:18:32 using cpu time.
M-function in file /Applications/MATLAB_R2010a.app/toolbox/matlab/scribe/legendcolorbarlayout.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
scribe.legend.initM-function3
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
29
doLayout(double(ax));
10.059 s75.0%
111
elseif ~strcmp(location,'none'...
10.010 s12.5%
34
list = createListeners(ax);
10.010 s12.5%
120
end
10 s0%
119
setappdata(hax,'LegendColorbar...
10 s0%
All other lines  0 s0%
Totals  0.079 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
legendcolorbarlayout>doLayoutM-subfunction10.059 s75.0%
legendcolorbarlayout>createListenersM-subfunction10.010 s12.5%
fliplrM-function10 s0%
legendcolorbarlayout>getListenersM-subfunction20 s0%
Self time (built-ins, overhead, etc.)  0.010 s12.5%
Totals  0.079 s100% 
M-Lint results
No M-Lint messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function139
Non-code lines (comments, blank lines)44
Code lines (lines that can run)95
Code lines that did run28
Code lines that did not run67
Coverage (did run/can run)29.47 %
Function listing
   time   calls  line
1 function legendcolorbarlayout(ax,action,h)
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
3 26 switch(action)
27
3 28 case 'layout'
0.06 1 29 doLayout(double(ax));
30
2 31 case 'on'
1 32 list = getListeners(ax);
1 33 if isempty(list)
< 0.01 1 34 list = createListeners(ax);
1 35 end
1 36 set(list,'enable','on');
37
1 38 case 'off'
39 list = getListeners(ax);
40 if ~isempty(list)
41 set(list,'enable','on');
42 end
43
1 44 case 'remove'
45 if ~isempty(getListeners(ax))
46 rmListeners(ax);
47 end
48
1 49 case 'objectChanged' % called when one object in the layout changes size
50
51 location = get(h,'Location');
52 if strncmp(fliplr(location),'edistuO',7) % match 'FooOutside'
53 legendcolorbarlayout(ax,'resetOuterLayout');
54 elseif isa(handle(h),'scribe.legend') && any(strcmp(location,{'Best','none'}))
55 h = handle(h);
56 if strcmp(location,'none')
57 resizeManualLegend(h);
58 else
59 doBestLegendLayout(ax,h);
60 end
61 return;
62 end
63
64 doLayout(ax);
65
1 66 case 'removeFromLayoutList'
67 if isempty(ax) || ~ishandle(ax) || ...
68 isempty(h) || ~ishandle(h) || ...
69 isempty(getListeners(ax))
70 if ishandle(ax) % TODO: really needed? hgload
71 reclaimSpace(ax,[]);
72 end
73 return;
74 end
75 hax = handle(ax);
76
77 list = getappdata(ax,'LegendColorbarOuterList');
78 list(~ishandle(list)) = [];
79 isouter = list == handle(h);
80 if any(isouter)
81 list(isouter) = [];
82 reclaimSpace(ax,list);
83 end
84 setappdata(hax,'LegendColorbarOuterList',list)
85 list2 = getappdata(ax,'LegendColorbarInnerList');
86 list2(~ishandle(list2)) = [];
87 list2(list2 == handle(h)) = [];
88 setappdata(hax,'LegendColorbarInnerList',list2)
89
1 90 case 'addToLayoutList'
1 91 if isempty(ax) || ~ishandle(ax) || ...
92 isempty(h) || ~ishandle(h) || ...
93 isempty(getListeners(ax))
94 return;
95 end
1 96 hax = handle(ax);
97
1 98 hh = handle(h);
1 99 location = get(h,'Location');
1 100 if strcmp(location,'BestOutside')
101 location = calculate_best_outside(h);
102 end
1 103 if strncmp(fliplr(location),'edistuO',7)
104 list = getappdata(ax,'LegendColorbarOuterList');
105 list(~ishandle(list)) = [];
106 if any(list == hh), return; end
107 if isempty(list), initInsetAppdata(ax); end
108 list = [hh;list];
109 setappdata(hax,'LegendColorbarOuterList',list)
110 makeSpace(ax,hh,location);
< 0.01 1 111 elseif ~strcmp(location,'none') && ~strcmp(location,'manual')
1 112 if strcmp(location,'Best')
113 doBestLegendLayout(ax,h);
114 end
1 115 list = getappdata(ax,'LegendColorbarInnerList');
1 116 list(~ishandle(list)) = [];
1 117 if any(list == hh), return; end
1 118 list = [hh;list];
1 119 setappdata(hax,'LegendColorbarInnerList',list)
1 120 end
121
122 case 'resetOuterLayout'
123 if isempty(ax) || ~ishandle(ax) || ...
124 isempty(getListeners(ax))
125 if nargin > 2 && ishandle(ax) && strcmp(h,'force')
126 reclaimSpace(ax,[]);
127 end
128 return;
129 end
130 list = getappdata(ax,'LegendColorbarOuterList');
131 list(~ishandle(list)) = [];
132 if ~isempty(list)
133 reclaimSpace(ax,list);
134 end
135
136 case 'layoutNoPixelBounds'
137 doLayout(double(ax),false);
138
139 end

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