Mercurial > hg > octave-lyh
diff scripts/plot/area.m @ 7215:dd88d61d443f
[project @ 2007-11-29 16:44:45 by jwe]
author | jwe |
---|---|
date | Thu, 29 Nov 2007 16:46:40 +0000 |
parents | fdb3840cec66 |
children | 9a6f4713f765 3342d1a7c4c9 |
line wrap: on
line diff
--- a/scripts/plot/area.m +++ b/scripts/plot/area.m @@ -40,18 +40,13 @@ function h = area (varargin) + [ax, varargin, nargin] = __plt_get_axis_arg__ ("area", varargin{:}); + if (nargin > 0) idx = 1; - ax = []; x = y = []; bv = 0; args = {}; - ## Check for axes parent. - if (ishandle (varargin{idx}) - && strcmp (get (varargin{idx}, "type"), "axes")) - ax = varargin{idx}; - idx++; - endif ## Check for (X) or (X,Y) arguments and possible base value. if (nargin >= idx && ismatrix (varargin{idx})) y = varargin{idx}; @@ -87,11 +82,13 @@ x = repmat (x(:), 1, size (y, 2)); endif - if (isempty (ax)) - tmp = __area__ (gca (), x, y, bv, args{:}); - else + oldax = gca (); + unwind_protect + axes (ax); tmp = __area__ (ax, x, y, bv, args{:}); - endif + unwind_protect_cleanup + axes (oldax); + end_unwind_protect if (nargout > 0) h = tmp;