This is a static copy of a profile reportHome
scribe.legend.legend (14 calls, 1.771 sec)
Generated 05-Aug-2011 13:01:36 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/scribe/@scribe/@legend/legend.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
122 | h.init(); | 14 | 1.235 s | 69.8% |  |
115 | methods(h,'create_legend_items... | 14 | 0.186 s | 10.5% |  |
62 | set(b,'ButtonUpFcn',methods(h,... | 14 | 0.066 s | 3.7% |  |
46 | h = scribe.legend('Parent',par... | 14 | 0.044 s | 2.5% |  |
57 | b = hggetbehavior(double(h),'D... | 14 | 0.033 s | 1.9% |  |
All other lines | | | 0.208 s | 11.7% |  |
Totals | | | 1.771 s | 100% | |
Children (called functions)
Code Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 150 |
Non-code lines (comments, blank lines) | 51 |
Code lines (lines that can run) | 99 |
Code lines that did run | 71 |
Code lines that did not run | 28 |
Coverage (did run/can run) | 71.72 % |
Function listing
time calls line
1 function h=legend(varargin)
2 %LEGEND creates the scribe legend object
3 % H=SCRIBE.LEGEND creates a scribe legend instance
4 %
5 % See also PLOTEDIT
6
7 % Copyright 1984-2007 The MathWorks, Inc.
8
14 9 if (nargin == 0) || ischar(varargin{1})
10 hasConvenienceArgs = false;
11 parind = find(strcmpi(varargin,'parent'));
12 if isempty(parind)
13 fig = gcf;
14 else
15 par = varargin{parind(end)+1};
16 fig = ancestor(varargin{parind(end)+1},'figure');
17 end
18 if ~isappdata(0,'BusyDeserializing')
19 ax = get(fig,'CurrentAxes');
20 if isempty(ax)
21 ax = axes('parent',fig);
22 end
23 position = [];
24 children = [];
25 par = get(ax,'Parent');
26 end
14 27 else
14 28 hasConvenienceArgs = true;
14 29 ax=varargin{1};
14 30 fig = ancestor(ax,'figure');
14 31 orient=varargin{2};
14 32 location=varargin{3};
14 33 position=varargin{4};
14 34 children=varargin{5};
14 35 listen=varargin{6};
14 36 strings=varargin{7};
14 37 varargin(1:7) = [];
14 38 par = get(ax,'Parent');
14 39 end
40 % be sure nextplot is 'add'
14 41 oldNextPlot = get(fig,'NextPlot');
14 42 if strcmp(oldNextPlot,'replacechildren') || strcmp(oldNextPlot,'replace')
43 set(fig,'NextPlot','add');
44 end
45 % start not visible so resizing etc. can't be seen.
0.04 14 46 h = scribe.legend('Parent',par,'Tag','legend','Visible','off', ...
47 'Units','normalized','Interruptible','off', ...
48 'LooseInset',[0 0 0 0]);
14 49 set(h,'EdgeColor',get(par,'DefaultAxesXColor'));
14 50 set(h,'TextColor',get(par,'DefaultTextColor'));
0.03 14 51 b = hggetbehavior(double(h),'Pan');
14 52 set(b,'Enable',false);
0.02 14 53 b = hggetbehavior(double(h),'Zoom');
14 54 set(b,'Enable',false);
0.03 14 55 b = hggetbehavior(double(h),'Rotate3D');
14 56 set(b,'Enable',false);
0.03 14 57 b = hggetbehavior(double(h),'DataCursor');
14 58 set(b,'Enable',false);
0.02 14 59 b = hggetbehavior(double(h),'Plotedit');
14 60 set(b,'KeepContextMenu',true);
14 61 set(b,'AllowInteriorMove',true);
0.07 14 62 set(b,'ButtonUpFcn',methods(h,'getfunhan','-noobj','ploteditbup'));
14 63 set(b,'EnableCopy',false);
64
14 65 if ~isappdata(0,'BusyDeserializing')
66
14 67 if hasConvenienceArgs
68 % set legendinfochildren on if children are legendinfo objects
14 69 if isa(children(1),'scribe.legendinfo')
70 h.LegendInfoChildren = 'on';
71 end
14 72 h.Plotchildren = children;
14 73 if listen
74 h.PlotChildListen = 'on';
14 75 else
14 76 h.PlotChildListen = 'off';
14 77 end
14 78 h.Orientation = orient;
14 79 h.Location = location;
14 80 h.String = strings;
14 81 end
14 82 h.Axes = ax;
83 % font properties from axes
14 84 h.FontName = get(ax,'fontname');
14 85 h.FontAngle = get(ax,'fontangle');
0.02 14 86 h.FontSize = get(ax,'fontsize');
14 87 h.FontWeight = get(ax,'fontweight');
14 88 h.Units = 'normalized';
14 89 h.Selected = 'off';
14 90 if strcmp(get(ax,'color'),'none')
91 h.Color = get(fig,'color');
14 92 else
14 93 h.Color = get(ax,'color');
14 94 end
95
0.02 14 96 set(double(h),...
97 'Units','normalized',...
98 'Box','on',...
99 'DrawMode', 'fast',...
100 'NextPlot','add',...
101 'XTick',-1,...
102 'YTick',-1,...
103 'XTickLabel','',...
104 'YTickLabel','',...
105 'XLim',[0 1],...
106 'YLim',[0 1], ...
107 'Clipping','on',...
108 'Color',h.Color,...
109 'View',[0 90],...
110 'CLim',get(ax,'CLim'));
14 111 set(h,'Units',get(ax,'Units'));
112
0.01 14 113 set(fig,'NextPlot',oldNextPlot);
14 114 if ~isempty(children)
0.19 14 115 methods(h,'create_legend_items',children);
14 116 end
117
14 118 set(double(h),'visible','on');
0.01 14 119 set(fig,'currentaxes',ax);
120
121 %%Initialize the listeners
1.24 14 122 h.init();
123
124 % set other properties passed in varargin
14 125 set(h,varargin{:});
126
127 % Set the positin manually, if specified
14 128 if ~isempty(position) && length(position)==4
129 units = get(double(h), 'units');
130 set(double(h), 'units', 'normalized');
131 set(double(h),'Position',position);
132 set(double(h), 'units', units);
133 end
134
135 % SET USER DATA
136 % Note: The 'update_userdata' method MUST be called only after all the
137 % listeners are initialized.
0.02 14 138 methods(h,'update_userdata');
139
140 % Add appdata to the axes that points back to the legend. This appdata
141 % will be used to speed up the execution time of the h = legend(ax)
142 % syntax.
14 143 setappdata(double(ax),'LegendPeerHandle',double(h));
144
145 % set legend ready (complete) on.
14 146 h.Ready = 'on';
147
14 148 end
149 % now make visible
14 150 set(h,'Visible','on');