time | Calls | line |
|---|
| | 100 | function fig = ObserveFigureNextPlot(fig, hsave)
|
| | 101 | %
|
| | 102 | % Helper fcn for preparing figure for nextplot, optionally
|
| | 103 | % preserving specific existing descendants.
|
| | 104 | % GUARANTEED to return a figure, even if some crazy combination
|
| | 105 | % of create / delete fcns deletes it.
|
| | 106 |
|
< 0.001 | 5 | 107 | switch fig.NextPlot
|
< 0.001 | 5 | 108 | case 'new'
|
| | 109 | % if someone calls plot(x,y,'parent',h) and h is an axes
|
| | 110 | % in a figure with NextPlot 'new', ignore the 'new' and
|
| | 111 | % treat it as 'add' - just add the axes to that figure.
|
| | 112 | if isempty(hsave)
|
| | 113 | fig = figure;
|
| | 114 | end
|
< 0.001 | 5 | 115 | case 'replace'
|
| | 116 | clf(fig, 'reset', hsave);
|
< 0.001 | 5 | 117 | case 'replacechildren'
|
| | 118 | clf(fig, hsave);
|
< 0.001 | 5 | 119 | case 'add'
|
| | 120 | % nothing
|
< 0.001 | 5 | 121 | end
|
< 0.001 | 5 | 122 | if ~any(ishghandle(fig)) && isempty(hsave)
|
| | 123 | fig = figure;
|
< 0.001 | 5 | 124 | end
|
Other subfunctions in this file are not included in this listing.