comparison scripts/plot/patch.m @ 6988:c7484dcadd4d

[project @ 2007-10-09 19:58:32 by dbateman]
author dbateman
date Tue, 09 Oct 2007 19:59:51 +0000
parents 76e3d985ae56
children 93c65f2a5668
comparison
equal deleted inserted replaced
6987:deb175b6e4a1 6988:c7484dcadd4d
19 19
20 ## -*- texinfo -*- 20 ## -*- texinfo -*-
21 ## @deftypefn {Function File} {} patch () 21 ## @deftypefn {Function File} {} patch ()
22 ## @deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{c}) 22 ## @deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{c})
23 ## @deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{c}, @var{opts}) 23 ## @deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{c}, @var{opts})
24 ## @deftypefnx {Function File} {} patch (@var{h}, @dots{})
24 ## Create patch object from @var{x} and @var{y} with color @var{c} and 25 ## Create patch object from @var{x} and @var{y} with color @var{c} and
25 ## insert in the current axes object. Return handle to patch object. 26 ## insert in the current axes object. Return handle to patch object.
26 ## 27 ##
27 ## For a uniform colored patch, @var{c} can be given as an RGB vector, 28 ## For a uniform colored patch, @var{c} can be given as an RGB vector,
28 ## scalar value referring to the current colormap, or string value (for 29 ## scalar value referring to the current colormap, or string value (for
31 32
32 ## Author: jwe 33 ## Author: jwe
33 34
34 function h = patch (varargin) 35 function h = patch (varargin)
35 36
36 ## make a default patch object, and make it the current axes for 37 if (isscalar (varargin{1}) && ishandle (varargin{1}))
37 ## the current figure. 38 h = varargin {1};
38 tmp = __patch__ (gca (), varargin{:}); 39 if (! strcmp (get (h, "type"), "axes"))
40 error ("patch: expecting first argument to be an axes object");
41 endif
42 oldh = gca ();
43 unwind_protect
44 axes (h);
45 tmp = __patch__ (h, varargin{:});
46 unwind_protect_cleanup
47 axes (oldh);
48 end_unwind_protect
49 else
50 tmp = __patch__ (gca (), varargin{:});
51 endif
39 52
40 if (nargout > 0) 53 if (nargout > 0)
41 h = tmp; 54 h = tmp;
42 endif 55 endif
43 56