This is a static copy of a profile reportHome
newplot (27 calls, 0.041 sec)
Generated 18-Mar-2011 23:31:43 using cpu time.
M-function in file /Applications/MATLAB_R2010a.app/toolbox/matlab/graphics/newplot.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 |
75 | ax = ObserveAxesNextPlot(ax, h... | 27 | 0.010 s | 25.0% |  |
69 | if isempty(ax) | 27 | 0.010 s | 25.0% |  |
65 | fig = ObserveFigureNextPlot(fi... | 27 | 0.010 s | 25.0% |  |
49 | if ~isempty(hsave) | 27 | 0.010 s | 25.0% |  |
79 | end | 27 | 0 s | 0% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 0.041 s | 100% | |
Children (called functions)
M-Lint results
No M-Lint messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 79 |
Non-code lines (comments, blank lines) | 47 |
Code lines (lines that can run) | 32 |
Code lines that did run | 16 |
Code lines that did not run | 16 |
Coverage (did run/can run) | 50.00 % |
Function listing
time calls line
1 function axReturn = newplot(hsave)
2 %NEWPLOT M-file preamble for NextPlot property.
3 % NEWPLOT prepares figure, axes for graphics according to NextPlot.
4 % H = NEWPLOT returns the handle of the prepared axes.
5 % H = NEWPLOT(HSAVE) prepares and returns an axes, but does not
6 % delete any objects whose handles appear in HSAVE. If HSAVE is
7 % specified, the figure and axes containing HSAVE are prepared
8 % instead of the current axes of the current figure. If HSAVE is
9 % empty, NEWPLOT behaves as if it were called without any inputs.
10 %
11 % NEWPLOT is a standard preamble command that is put at
12 % the beginning of graphics M-file functions that draw graphs
13 % using only low-level object creation commands. NEWPLOT
14 % "does the right thing" in terms of determining which axes and/or
15 % figure to draw the plot in, based upon the setting of the
16 % NextPlot property of axes and figure objects, and returns a
17 % handle to the appropriate axes.
18 %
19 % The "right thing" is:
20 %
21 % First, prepare a figure for graphics:
22 % Clear and reset the current figure using CLF RESET if its NextPlot
23 % is 'replace', or clear the current figure using CLF if its
24 % NextPlot is 'replacechildren', or reuse the current figure as-is
25 % if its NextPlot is 'add', or if no figures exist, create a figure.
26 % When the figure is prepared, set its NextPlot to 'add', and then
27 % prepare an axes in that figure:
28 % Clear and reset the current axes using CLA RESET if its NextPlot
29 % is 'replace', or clear the current axes using CLA if its NextPlot
30 % is 'replacechildren', or reuse the current axes as-is if its
31 % NextPlot is 'add', or if no axes exist, create an axes.
32 %
33 % See also HOLD, ISHOLD, FIGURE, AXES, CLA, CLF.
34
35 % Copyright 1984-2009 The MathWorks, Inc.
36 % $Revision: 5.13.6.10 $ $Date: 2009/04/21 03:24:34 $
37 % Built-in function.
38
27 39 if nargin == 0 || isempty(hsave)
27 40 hsave = [];
41 elseif ~isscalar(hsave) || ~ishghandle(hsave)
42 error('MATLAB:newplot:InvalidHandle', 'bad handle')
43 end
44
45
27 46 fig = [];
27 47 ax = [];
48
0.01 27 49 if ~isempty(hsave)
50 obj = hsave;
51 while ~isempty(obj)
52 if strcmp(get(obj,'type'),'figure')
53 fig = obj;
54 elseif strcmp(get(obj,'type'),'axes')
55 ax = obj;
56 end
57 obj = get(obj,'parent');
58 end
59 end
60
27 61 if isempty(fig)
27 62 fig = gcf;
27 63 end
64
0.01 27 65 fig = ObserveFigureNextPlot(fig, hsave);
66 % for clay
27 67 set(fig,'nextplot','add');
68
0.01 27 69 if isempty(ax)
27 70 ax = gca(fig);
71 elseif ~any(ishghandle(ax))
72 error('MATLAB:newplot:NoAxesParent', 'axis parent deleted')
73 end
74
0.01 27 75 ax = ObserveAxesNextPlot(ax, hsave);
76
27 77 if nargout
27 78 axReturn = ax;
27 79 end
Other subfunctions in this file are not included in this listing.