This is a static copy of a profile reportHome
legend>make_legend (2 calls, 0.881 sec)
Generated 18-Mar-2011 23:31:45 using cpu time.
M-subfunction in file /Applications/MATLAB_R2010a.app/toolbox/matlab/scribe/legend.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
legend | M-function | 2 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
389 | lh=scribe.legend(ha,orient,loc... | 2 | 0.477 s | 54.1% |  |
357 | children = graph2dhelper ('get... | 2 | 0.342 s | 38.8% |  |
374 | if isappdata(child,'LegendLege... | 372 | 0.021 s | 2.4% |  |
343 | if ~is2D(ha) | 2 | 0.021 s | 2.4% |  |
387 | [children,strings,warnmsg] = c... | 2 | 0.010 s | 1.2% |  |
All other lines | | | 0.010 s | 1.2% |  |
Totals | | | 0.881 s | 100% | |
Children (called functions)
M-Lint 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
326 function [leg,warnmsg] = make_legend(ha,argin)
327
328 % find and delete existing legend
2 329 leg = find_legend(ha);
2 330 if ~isempty(leg)
331 delete_legend(leg);
332 end
333 % process args
0.01 2 334 [orient,location,position,children,listen,strings,propargs] = process_inputs(ha,argin);
335
336 % set position if empty
2 337 if isempty(position)
2 338 position = -1;
2 339 end
340
341 % set location if empty
2 342 if isempty(location)
0.02 2 343 if ~is2D(ha)
344 location = 'NorthEastOutside';
2 345 else
2 346 location = 'NorthEast';
2 347 end
2 348 end
349 % check prop val args
2 350 if ~isempty(propargs)
351 check_pv_args(propargs);
352 end
353 % get children if empty
2 354 auto_children = false;
2 355 if isempty(children)
2 356 auto_children = true;
0.34 2 357 children = graph2dhelper ('get_legendable_children', ha, false);
358 % if still no children, return empty
2 359 if isempty(children)
360 warnmsg = struct('identifier',id('PlotEmpty'),...
361 'message','Plot empty.');
362 hfig=ancestor(ha,'figure');
363 ltogg = uigettool(hfig,'Annotation.InsertLegend');
364 if ~isempty(ltogg)
365 set(ltogg,'State','off');
366 end
367 leg = [];
368 return;
369 end
2 370 end
2 371 for k=1:length(children)
372 372 child = children(k);
372 373 leginfo = getappdata(child,'LegendLegendInfo');
0.02 372 374 if isappdata(child,'LegendLegendInfo') && ...
375 (isempty(leginfo) || ~ishandle(leginfo))
376 try
377 setLegendInfo(handle(child));
378 catch ex %#ok<NASGU>
379 lis = getappdata(child, 'LegendLegendInfoStruct');
380 if ~isempty(lis)
381 legendinfo(child, lis{:});
382 end
383 end
384 end
372 385 end
386 % fill in strings if needed
0.01 2 387 [children,strings,warnmsg] = check_legend_strings(children,strings,auto_children);
388 % create legend
0.48 2 389 lh=scribe.legend(ha,orient,location,position,children,listen,strings,propargs{:});
390 % convert to double
2 391 leg=double(lh);
392
393 % Inform basic fitting that legend is ready
2 394 send(lh, 'LegendConstructorDone', handle.EventData(handle(lh), 'LegendConstructorDone'));
Other subfunctions in this file are not included in this listing.