6788
|
1 ## Copyright (C) 1999,2000 Kai Habel |
|
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 2, or (at your option) |
|
8 ## 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, write to the Free |
|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301, USA. |
|
19 |
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} bone (@var{n}) |
|
22 ## Create color colormap. This colormap is a gray colormap with a light |
|
23 ## blue tone. The argument @var{n} should be a scalar. If it |
|
24 ## is omitted, the length of the current colormap or 64 is assumed. |
|
25 ## @seealso{colormap} |
|
26 ## @end deftypefn |
|
27 |
|
28 ## Author: Kai Habel <kai.habel@gmx.de> |
|
29 |
|
30 function map = bone (number) |
|
31 |
|
32 if (nargin == 0) |
|
33 number = rows (colormap); |
|
34 elseif (nargin == 1) |
6791
|
35 if (! isscalar (number)) |
6788
|
36 error ("bone: argument must be a scalar"); |
|
37 endif |
|
38 else |
|
39 print_usage (); |
|
40 endif |
|
41 |
|
42 if (number == 1) |
|
43 map = [0, 0, 0]; |
|
44 elseif (number > 1) |
|
45 x = linspace (0, 1, number)'; |
|
46 |
|
47 r = (x < 3/4) .* (7/8 * x) + (x >= 3/4) .* (11/8 * x - 3/8); |
|
48 g = (x < 3/8) .* (7/8 * x)\ |
|
49 + (x >= 3/8 & x < 3/4) .* (29/24 * x - 1/8)\ |
|
50 + (x >= 3/4) .* (7/8 * x + 1/8); |
|
51 b = (x < 3/8) .* (29/24 * x) + (x >= 3/8) .* (7/8 * x + 1/8); |
|
52 map = [r, g, b]; |
|
53 else |
|
54 map = []; |
|
55 endif |
|
56 endfunction |