This is a static copy of a profile reportHome
legend>make_legend (14 calls, 1.989 sec)
Generated 05-Aug-2011 13:02:04 using cpu time.
subfunction in file /usr/local/MATLAB/R2011a/toolbox/matlab/scribe/legend.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
legend | function | 14 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
388 | lh=scribe.legend(ha,orient,loc... | 14 | 1.771 s | 89.0% |  |
356 | children = graph2dhelper ('get... | 13 | 0.153 s | 7.7% |  |
333 | [orient,location,position,chil... | 14 | 0.033 s | 1.6% |  |
386 | [children,strings,warnmsg] = c... | 14 | 0.022 s | 1.1% |  |
342 | if ~is2D(ha) | 4 | 0.011 s | 0.5% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 1.989 s | 100% | |
Children (called functions)
Code Analyzer results
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 69 |
Non-code lines (comments, blank lines) | 18 |
Code lines (lines that can run) | 51 |
Code lines that did run | 28 |
Code lines that did not run | 23 |
Coverage (did run/can run) | 54.90 % |
Function listing
time calls line
325 function [leg,warnmsg] = make_legend(ha,argin)
326
327 % find and delete existing legend
14 328 leg = find_legend(ha);
14 329 if ~isempty(leg)
330 delete_legend(leg);
331 end
332 % process args
0.03 14 333 [orient,location,position,children,listen,strings,propargs] = process_inputs(ha,argin);
334
335 % set position if empty
14 336 if isempty(position)
14 337 position = -1;
14 338 end
339
340 % set location if empty
14 341 if isempty(location)
0.01 4 342 if ~is2D(ha)
343 location = 'NorthEastOutside';
4 344 else
4 345 location = 'NorthEast';
4 346 end
4 347 end
348 % check prop val args
14 349 if ~isempty(propargs)
350 check_pv_args(propargs);
351 end
352 % get children if empty
14 353 auto_children = false;
14 354 if isempty(children)
13 355 auto_children = true;
0.15 13 356 children = graph2dhelper ('get_legendable_children', ha);
357 % if still no children, return empty
13 358 if isempty(children)
359 warnmsg = struct('identifier',id('PlotEmpty'),...
360 'message','Plot empty.');
361 hfig=ancestor(ha,'figure');
362 ltogg = uigettool(hfig,'Annotation.InsertLegend');
363 if ~isempty(ltogg)
364 set(ltogg,'State','off');
365 end
366 leg = [];
367 return;
368 end
13 369 end
14 370 for k=1:length(children)
55 371 child = children(k);
55 372 leginfo = getappdata(child,'LegendLegendInfo');
55 373 if isappdata(child,'LegendLegendInfo') && ...
374 (isempty(leginfo) || ~ishandle(leginfo))
375 try
376 setLegendInfo(handle(child));
377 catch ex %#ok<NASGU>
378 lis = getappdata(child, 'LegendLegendInfoStruct');
379 if ~isempty(lis)
380 legendinfo(child, lis{:});
381 end
382 end
383 end
55 384 end
385 % fill in strings if needed
0.02 14 386 [children,strings,warnmsg] = check_legend_strings(children,strings,auto_children);
387 % create legend
1.77 14 388 lh=scribe.legend(ha,orient,location,position,children,listen,strings,propargs{:});
389 % convert to double
14 390 leg=double(lh);
391
392 % Inform basic fitting that legend is ready
14 393 send(lh, 'LegendConstructorDone', handle.EventData(handle(lh), 'LegendConstructorDone'));
Other subfunctions in this file are not included in this listing.