This is a static copy of a profile reportHome
scribe.legend.legend (2 calls, 0.477 sec)
Generated 18-Mar-2011 23:32:26 using cpu time.
M-function in file /Applications/MATLAB_R2010a.app/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(); | 2 | 0.270 s | 56.5% |  |
115 | methods(h,'create_legend_items... | 2 | 0.062 s | 13.0% |  |
62 | set(b,'ButtonUpFcn',methods(h,... | 2 | 0.062 s | 13.0% |  |
51 | b = hggetbehavior(double(h),'P... | 2 | 0.041 s | 8.7% |  |
138 | methods(h,'update_userdata'); | 2 | 0.010 s | 2.2% |  |
All other lines | | | 0.031 s | 6.5% |  |
Totals | | | 0.477 s | 100% | |
Children (called functions)
M-Lint results
No M-Lint 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
2 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
2 27 else
2 28 hasConvenienceArgs = true;
2 29 ax=varargin{1};
2 30 fig = ancestor(ax,'figure');
2 31 orient=varargin{2};
0.01 2 32 location=varargin{3};
2 33 position=varargin{4};
2 34 children=varargin{5};
2 35 listen=varargin{6};
2 36 strings=varargin{7};
2 37 varargin(1:7) = [];
2 38 par = get(ax,'Parent');
2 39 end
40 % be sure nextplot is 'add'
2 41 oldNextPlot = get(fig,'NextPlot');
2 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.
2 46 h = scribe.legend('Parent',par,'Tag','legend','Visible','off', ...
47 'Units','normalized','Interruptible','off', ...
48 'LooseInset',[0 0 0 0]);
2 49 set(h,'EdgeColor',get(par,'DefaultAxesXColor'));
2 50 set(h,'TextColor',get(par,'DefaultTextColor'));
0.04 2 51 b = hggetbehavior(double(h),'Pan');
2 52 set(b,'Enable',false);
2 53 b = hggetbehavior(double(h),'Zoom');
2 54 set(b,'Enable',false);
0.01 2 55 b = hggetbehavior(double(h),'Rotate3D');
2 56 set(b,'Enable',false);
2 57 b = hggetbehavior(double(h),'DataCursor');
2 58 set(b,'Enable',false);
0.01 2 59 b = hggetbehavior(double(h),'Plotedit');
2 60 set(b,'KeepContextMenu',true);
2 61 set(b,'AllowInteriorMove',true);
0.06 2 62 set(b,'ButtonUpFcn',methods(h,'getfunhan','-noobj','ploteditbup'));
2 63 set(b,'EnableCopy',false);
64
2 65 if ~isappdata(0,'BusyDeserializing')
66
2 67 if hasConvenienceArgs
68 % set legendinfochildren on if children are legendinfo objects
2 69 if isa(children(1),'scribe.legendinfo')
70 h.LegendInfoChildren = 'on';
71 end
2 72 h.Plotchildren = children;
2 73 if listen
74 h.PlotChildListen = 'on';
2 75 else
2 76 h.PlotChildListen = 'off';
2 77 end
2 78 h.Orientation = orient;
2 79 h.Location = location;
2 80 h.String = strings;
2 81 end
2 82 h.Axes = ax;
83 % font properties from axes
2 84 h.FontName = get(ax,'fontname');
2 85 h.FontAngle = get(ax,'fontangle');
2 86 h.FontSize = get(ax,'fontsize');
2 87 h.FontWeight = get(ax,'fontweight');
2 88 h.Units = 'normalized';
2 89 h.Selected = 'off';
2 90 if strcmp(get(ax,'color'),'none')
91 h.Color = get(fig,'color');
2 92 else
2 93 h.Color = get(ax,'color');
2 94 end
95
2 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'));
2 111 set(h,'Units',get(ax,'Units'));
112
2 113 set(fig,'NextPlot',oldNextPlot);
2 114 if ~isempty(children)
0.06 2 115 methods(h,'create_legend_items',children);
2 116 end
117
2 118 set(double(h),'visible','on');
2 119 set(fig,'currentaxes',ax);
120
121 %%Initialize the listeners
0.27 2 122 h.init();
123
124 % set other properties passed in varargin
2 125 set(h,varargin{:});
126
127 % Set the positin manually, if specified
2 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.01 2 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.
2 143 setappdata(double(ax),'LegendPeerHandle',double(h));
144
145 % set legend ready (complete) on.
2 146 h.Ready = 'on';
147
2 148 end
149 % now make visible
2 150 set(h,'Visible','on');