comparison scripts/plot/pcolor.m @ 7109:5436efbf35e3

[project @ 2007-11-06 22:16:25 by jwe]
author jwe
date Tue, 06 Nov 2007 22:16:25 +0000
parents
children 0e63f1126f01
comparison
equal deleted inserted replaced
7108:60a1165732f9 7109:5436efbf35e3
1
2 ## Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2004,
3 ## 2005, 2006, 2007 John W. Eaton
4 ##
5 ## This file is part of Octave.
6 ##
7 ## Octave is free software; you can redistribute it and/or modify it
8 ## under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation; either version 3 of the License, or (at
10 ## your option) any later version.
11 ##
12 ## Octave is distributed in the hope that it will be useful, but
13 ## WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ## General Public License for more details.
16 ##
17 ## You should have received a copy of the GNU General Public License
18 ## along with Octave; see the file COPYING. If not, see
19 ## <http://www.gnu.org/licenses/>.
20
21 ## -*- texinfo -*-
22 ## @deftypefn {Function File} {} pcolor (@var{x}, @var{y}, @var{c})
23 ## @deftypefnx {Function File} {} pcolor (@var{c})
24 ## Density plot for given matrices @var{x}, and @var{y} from @code{meshgrid} and
25 ## a matrix @var{c} corresponding to the @var{x} and @var{y} coordinates of
26 ## the mesh. If @var{x} and @var{y} are vectors, then a typical vertex
27 ## is (@var{x}(j), @var{y}(i), @var{c}(i,j)). Thus, columns of @var{c}
28 ## correspond to different @var{x} values and rows of @var{c} correspond
29 ## to different @var{y} values.
30 ## @seealso{meshgrid, contour}
31 ## @end deftypefn
32
33 ## Author: jwe
34
35 function h = pcolor (x,y,c)
36
37 newplot ();
38
39 if (nargin == 1)
40 C = x;
41 Z = zeros(size(C));
42 [nr, nc] = size(C);
43 [X, Y] = meshgrid(1:nr, 1:nc);
44 elseif (nargin == 3)
45 Z = zeros(size(C));
46 else
47 print_usage();
48 end;
49
50
51 tmp = surface (X,Y,Z,C);
52 ax = get(tmp, "parent");
53 set (tmp, "FaceColor", "flat");
54 set (ax, "view", [0, 90]);
55 if (nargout > 0)
56 h = tmp;
57 endif
58
59 endfunction