]> Creatis software - CreaPhase.git/blob - octave_packages/image-1.0.15/rgbplot.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / image-1.0.15 / rgbplot.m
1 ## Copyright (C) 2005  Berge-Gladel
2 ## 
3 ## This program is free software; you can redistribute it and/or
4 ## modify it under the terms of the GNU General Public License
5 ## as published by the Free Software Foundation; either version 2
6 ## of the License, or (at your option) any later version.
7 ## 
8 ## This program is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 ## GNU General Public License for more details.
12
13 ## -*- texinfo -*-
14 ## @deftypefn {Function File} rgbplot (@var{map})
15 ## @deftypefnx{Function File} @var{h} = rgbplot (@var{map})
16 ## Plot a given color map.
17 ## The matrix @var{map} must be a @math{M} by 3 matrix. The three columns of the
18 ## colormap matrix are plotted in red, green, and blue lines.
19 ##
20 ## If an output is requested, a graphics handle to the plot is returned.
21 ## @end deftypefn
22
23 function h_out = rgbplot(map)
24   ## Check input
25   if (!ismatrix(map) || ndims(map) != 2 || columns(map) != 3)
26     error("rgbplot: input must be a M by 3 matrix");
27   endif
28
29   ## Plot
30   h = plot(map(:,1), "-r", map(:,2), "g-", map(:,3), "b-");
31   if (nargout > 0)
32     h_out = h;
33   endif
34 endfunction