comparison scripts/plot/surface.m @ 11587:c792872f8942

all script files: untabify and strip trailing whitespace
author John W. Eaton <jwe@octave.org>
date Thu, 20 Jan 2011 17:35:29 -0500
parents fd0a3ac60b0e
children e3e6079039c6
comparison
equal deleted inserted replaced
11586:12df7854fa7c 11587:c792872f8942
22 ## @deftypefnx {Function File} {} surface (@var{z}, @var{c}) 22 ## @deftypefnx {Function File} {} surface (@var{z}, @var{c})
23 ## @deftypefnx {Function File} {} surface (@var{z}) 23 ## @deftypefnx {Function File} {} surface (@var{z})
24 ## @deftypefnx {Function File} {} surface (@dots{}, @var{prop}, @var{val}) 24 ## @deftypefnx {Function File} {} surface (@dots{}, @var{prop}, @var{val})
25 ## @deftypefnx {Function File} {} surface (@var{h}, @dots{}) 25 ## @deftypefnx {Function File} {} surface (@var{h}, @dots{})
26 ## @deftypefnx {Function File} {@var{h} =} surface (@dots{}) 26 ## @deftypefnx {Function File} {@var{h} =} surface (@dots{})
27 ## Plot a surface graphic object given matrices @var{x}, and @var{y} from 27 ## Plot a surface graphic object given matrices @var{x}, and @var{y} from
28 ## @code{meshgrid} and a matrix @var{z} corresponding to the @var{x} and 28 ## @code{meshgrid} and a matrix @var{z} corresponding to the @var{x} and
29 ## @var{y} coordinates of the surface. If @var{x} and @var{y} are vectors, 29 ## @var{y} coordinates of the surface. If @var{x} and @var{y} are vectors,
30 ## then a typical vertex is (@var{x}(j), @var{y}(i), @var{z}(i,j)). Thus, 30 ## then a typical vertex is (@var{x}(j), @var{y}(i), @var{z}(i,j)). Thus,
31 ## columns of @var{z} correspond to different @var{x} values and rows of 31 ## columns of @var{z} correspond to different @var{x} values and rows of
32 ## @var{z} correspond to different @var{y} values. If @var{x} and @var{y} 32 ## @var{z} correspond to different @var{y} values. If @var{x} and @var{y}
33 ## are missing, they are constructed from size of the matrix @var{z}. 33 ## are missing, they are constructed from size of the matrix @var{z}.
34 ## 34 ##
35 ## Any additional properties passed are assigned to the surface. 35 ## Any additional properties passed are assigned to the surface.
36 ## @seealso{surf, mesh, patch, line} 36 ## @seealso{surf, mesh, patch, line}
114 error ("surface: X, Y, and Z must have the same dimensions"); 114 error ("surface: X, Y, and Z must have the same dimensions");
115 endif 115 endif
116 else 116 else
117 error ("surface: X and Y must be vectors and Z must be a matrix"); 117 error ("surface: X and Y must be vectors and Z must be a matrix");
118 endif 118 endif
119 elseif (firststring == 3) 119 elseif (firststring == 3)
120 z = varargin{1}; 120 z = varargin{1};
121 c = varargin{2}; 121 c = varargin{2};
122 if (ismatrix (z) && !isvector (z) && !isscalar (z)) 122 if (ismatrix (z) && !isvector (z) && !isscalar (z))
123 [nr, nc] = size (z); 123 [nr, nc] = size (z);
124 x = 1:nc; 124 x = 1:nc;
125 y = (1:nr)'; 125 y = (1:nr)';
126 else 126 else
127 error ("surface: Z argument must be a matrix"); 127 error ("surface: Z argument must be a matrix");
128 endif 128 endif
129 elseif (firststring == 2) 129 elseif (firststring == 2)
130 z = varargin{1}; 130 z = varargin{1};
131 c = z; 131 c = z;
132 if (ismatrix (z) && !isvector (z) && !isscalar (z)) 132 if (ismatrix (z) && !isvector (z) && !isscalar (z))
133 [nr, nc] = size (z); 133 [nr, nc] = size (z);
134 x = 1:nc; 134 x = 1:nc;