comparison scripts/image/gmap40.m @ 7189:e8d953d03f6a

[project @ 2007-11-26 20:42:09 by dbateman]
author dbateman
date Mon, 26 Nov 2007 20:42:11 +0000
parents
children b93ac0586e4b
comparison
equal deleted inserted replaced
7188:fdd7cd70dc14 7189:e8d953d03f6a
1 ## Copyright (C) 2007 David Bateman
2 ##
3 ## This file is part of Octave.
4 ##
5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3 of the License, or (at
8 ## your option) any later version.
9 ##
10 ## Octave is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>.
18
19 ## -*- texinfo -*-
20 ## @deftypefn {Function File} {} gmap40 (@var{n})
21 ## Create a color colormap. The colormap is red, green, blue, yellow,
22 ## magneta and cyan. These are the colors that are allowed with patch
23 ## objects using gnuplot 4.0, and so this colormap function is specially
24 ## designed for users of gnuplot 4.0. The argument @var{n} should be
25 ## a scalar. If it is omitted, a length of 6 is assumed. Larger values
26 ## of @var{n} result in a repetition of the above colors
27 ## @seealso{colormap}
28 ## @end deftypefn
29
30 function map = gmap40 (number)
31
32 if (nargin == 0)
33 number = 6;
34 elseif (nargin == 1)
35 if (! isscalar (number))
36 error ("gmap40: argument must be a scalar");
37 endif
38 else
39 print_usage ();
40 endif
41
42 if (number >= 1)
43 map = repmat ([1, 0, 0; 0, 1, 0; 0, 0, 1; 1, 1, 0; 1, 0, 1; 0, 1, 1],
44 ceil (number / 6), 1) (1:number, :);
45 else
46 map = [];
47 endif
48
49 endfunction