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