time | Calls | line |
---|
| | 127 | function ax = ObserveAxesNextPlot(ax, hsave)
|
| | 128 | %
|
| | 129 | % Helper fcn for preparing axes for nextplot, optionally
|
| | 130 | % preserving specific existing descendants
|
| | 131 | % GUARANTEED to return an axes in the same figure as the passed-in
|
| | 132 | % axes, even if that axes gets deleted by an overzealous create or
|
| | 133 | % delete fcn anywhere in the figure.
|
| | 134 |
|
| | 135 | % for performance only call ancestor when needed
|
0.003 | 60 | 136 | fig = ax.Parent;
|
0.002 | 60 | 137 | if ~isempty(fig) && ~strcmp(fig.Type,'figure')
|
| | 138 | fig = ancestor(fig,'figure');
|
< 0.001 | 60 | 139 | end
|
| | 140 |
|
0.001 | 60 | 141 | switch ax.NextPlot
|
< 0.001 | 60 | 142 | case 'replaceall'
|
| | 143 | cla(ax, 'reset', hsave);
|
< 0.001 | 60 | 144 | case 'replace'
|
| | 145 | % If there are multiple data spaces, ax.prepareForPlot() will do a
|
| | 146 | % reset of the properties for the active data space (while
|
| | 147 | % preserving other data spaces) and return false to indicate that a
|
| | 148 | % full reset is not necessary. Otherwise, ax.prepareForPlot() will
|
| | 149 | % return true.
|
< 0.001 | 12 | 150 | if (ax.prepareForPlot())
|
0.052 | 12 | 151 | cla(ax, 'reset', hsave);
|
| | 152 | else
|
| | 153 | cla(ax, hsave);
|
< 0.001 | 12 | 154 | end
|
< 0.001 | 48 | 155 | case 'replacechildren'
|
| | 156 | cla(ax, hsave);
|
< 0.001 | 48 | 157 | case 'add'
|
| | 158 | % nothing
|
< 0.001 | 60 | 159 | end
|
| | 160 |
|
< 0.001 | 60 | 161 | if ~any(ishghandle(ax)) && isempty(hsave)
|
| | 162 | if ~any(ishghandle(fig))
|
| | 163 | ax = axes;
|
| | 164 | else
|
| | 165 | ax = axes('Parent',fig);
|
| | 166 | end
|
< 0.001 | 60 | 167 | end
|
Other subfunctions in this file are not included in this listing.