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