1 ## Copyright (C) 2007-2012 David Bateman
3 ## This file is part of Octave.
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.
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.
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/>.
20 ## @deftypefn {Function File} {@var{map} =} gmap40 ()
21 ## @deftypefnx {Function File} {@var{map} =} gmap40 (@var{n})
22 ## Create color colormap. The colormap consists of red, green, blue, yellow,
23 ## magenta and cyan. This colormap is specifically designed for users of
24 ## gnuplot 4.0 where these 6 colors are the allowable ones for patch objects.
25 ## The argument @var{n} must be a scalar.
26 ## If unspecified, a length of 6 is assumed. Larger values
27 ## of @var{n} result in a repetition of the above colors.
31 function map = gmap40 (n)
37 error ("gmap40: argument must be a scalar");
44 map = repmat ([1, 0, 0; 0, 1, 0; 0, 0, 1; 1, 1, 0; 1, 0, 1; 0, 1, 1],
45 ceil (n / 6), 1) (1:n, :);
53 %! ## Show the 'gmap40' colormap as an image
54 %! image (1:6, linspace (0, 1, 6), repmat (1:6, 6, 1)')
55 %! axis ([1, 6, 0, 1], "ticy", "xy")
56 %! colormap (gmap40 (6))