comparison scripts/image/lines.m @ 14272:4f8d2931f886

lines.m: Add new colormap corresponding to ColorOrder property. * lines.m: New colormap file * scripts/image/module.mk: Add lines.m to build system. * image.txi: Add lines() to documentation. * NEWS: Add lines() to list of new functions in 3.8 * aspell-octave.en.pws: Add "ColorOrder" to list of spelling exceptions.
author Rik <octave@nomad.inbox5.com>
date Fri, 27 Jan 2012 20:54:15 -0800
parents
children f205d0074687
comparison
equal deleted inserted replaced
14271:e2a14d1b4eaa 14272:4f8d2931f886
1 ## Copyright (C) 2012 Rik Wehbring
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} {@var{map} =} lines ()
21 ## @deftypefnx {Function File} {@var{map} =} lines (@var{n})
22 ## Create color colormap. This colormap is composed of the list of colors
23 ## in the current axes "ColorOrder" property. The default is blue,
24 ## green, red, cyan, pink, yellow, and gray.
25 ## The argument @var{n} must be a scalar.
26 ## If unspecified, the length of the current colormap, or 64, is used.
27 ## @seealso{colormap}
28 ## @end deftypefn
29
30 function map = lines (n)
31
32 if (nargin == 0)
33 n = rows (colormap);
34 elseif (nargin == 1)
35 if (! isscalar (n))
36 error ("lines: argument must be a scalar");
37 endif
38 else
39 print_usage ();
40 endif
41
42 c = get (gca, "colororder");
43 nr = rows (c);
44 map = c(rem (0:(n-1), nr) + 1, :);
45
46 endfunction
47
48
49 %!demo
50 %! ## Show the 'lines' colormap as an image
51 %! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
52 %! axis ([1, 64, 0, 1], "ticy", "xy");
53 %! colormap (lines (64));
54