comparison scripts/plot/pcolor.m @ 7110:0e63f1126f01

[project @ 2007-11-06 22:36:22 by jwe]
author jwe
date Tue, 06 Nov 2007 22:36:22 +0000
parents 5436efbf35e3
children c7e5e638a8d0
comparison
equal deleted inserted replaced
7109:5436efbf35e3 7110:0e63f1126f01
1 1 ## Copyright (C) 2007 Kai Habel
2 ## Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2004,
3 ## 2005, 2006, 2007 John W. Eaton
4 ## 2 ##
5 ## This file is part of Octave. 3 ## This file is part of Octave.
6 ## 4 ##
7 ## Octave is free software; you can redistribute it and/or modify it 5 ## 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 6 ## under the terms of the GNU General Public License as published by
28 ## correspond to different @var{x} values and rows of @var{c} correspond 26 ## correspond to different @var{x} values and rows of @var{c} correspond
29 ## to different @var{y} values. 27 ## to different @var{y} values.
30 ## @seealso{meshgrid, contour} 28 ## @seealso{meshgrid, contour}
31 ## @end deftypefn 29 ## @end deftypefn
32 30
33 ## Author: jwe 31 ## Author: Kai Habel <kai.habel@gmx.de>
34 32
35 function h = pcolor (x,y,c) 33 function h = pcolor (x, y, c)
36 34
37 newplot (); 35 newplot ();
38 36
39 if (nargin == 1) 37 if (nargin == 1)
40 C = x; 38 c = x;
41 Z = zeros(size(C)); 39 z = zeros (size (c));
42 [nr, nc] = size(C); 40 [nr, nc] = size (c);
43 [X, Y] = meshgrid(1:nr, 1:nc); 41 [x, y] = meshgrid (1:nr, 1:nc);
44 elseif (nargin == 3) 42 elseif (nargin == 3)
45 Z = zeros(size(C)); 43 z = zeros (size (c));
46 else 44 else
47 print_usage(); 45 print_usage ();
48 end; 46 endif
49 47
48 tmp = surface (X, Y, Z, c);
50 49
51 tmp = surface (X,Y,Z,C); 50 ax = get (tmp, "parent");
52 ax = get(tmp, "parent"); 51
53 set (tmp, "FaceColor", "flat"); 52 set (tmp, "facecolor", "flat");
53
54 set (ax, "view", [0, 90]); 54 set (ax, "view", [0, 90]);
55
55 if (nargout > 0) 56 if (nargout > 0)
56 h = tmp; 57 h = tmp;
57 endif 58 endif
58 59
59 endfunction 60 endfunction