1## Copyright (C) 2007, 2008, 2009 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} {} gmap40 (@var{n})
21## Create a color colormap. The colormap is red, green, blue, yellow,
22## magenta 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
30function map = gmap40 (number)
35 if (! isscalar (number))
36 error ("gmap40: argument must be a scalar");
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, :);
52%! ## Show the 'gmap40' colormap as an image
53%! image (1:64, linspace (0, 1, 64), repmat (1:64, 64, 1)')
54%! axis ([1, 64, 0, 1], "ticy", "xy")