annotate scripts/image/rgbplot.m @ 20158:7503499a252b stable

doc: Update docstrings to have one sentence summary as first line. Update scripts in audio, elfun, general, geometry, and image directories. * scripts/audio/@audioplayer/__get_properties__.m, scripts/audio/@audioplayer/audioplayer.m, scripts/audio/@audioplayer/get.m, scripts/audio/@audioplayer/isplaying.m, scripts/audio/@audioplayer/play.m, scripts/audio/@audioplayer/playblocking.m, scripts/audio/@audioplayer/set.m, scripts/audio/@audioplayer/subsasgn.m, scripts/audio/@audioplayer/subsref.m, scripts/audio/@audiorecorder/audiorecorder.m, scripts/audio/@audiorecorder/get.m, scripts/audio/@audiorecorder/getaudiodata.m, scripts/audio/@audiorecorder/getplayer.m, scripts/audio/@audiorecorder/isrecording.m, scripts/audio/@audiorecorder/play.m, scripts/audio/@audiorecorder/record.m, scripts/audio/@audiorecorder/recordblocking.m, scripts/audio/@audiorecorder/set.m, scripts/audio/@audiorecorder/stop.m, scripts/audio/@audiorecorder/subsasgn.m, scripts/audio/@audiorecorder/subsref.m, scripts/audio/lin2mu.m, scripts/audio/mu2lin.m, scripts/audio/record.m, scripts/audio/sound.m, scripts/audio/soundsc.m, scripts/audio/wavread.m, scripts/audio/wavwrite.m, scripts/elfun/cosd.m, scripts/elfun/sind.m, scripts/elfun/tand.m, scripts/general/accumarray.m, scripts/general/accumdim.m, scripts/general/bitcmp.m, scripts/general/bitget.m, scripts/general/bitset.m, scripts/general/blkdiag.m, scripts/general/cart2pol.m, scripts/general/cart2sph.m, scripts/general/cell2mat.m, scripts/general/celldisp.m, scripts/general/chop.m, scripts/general/circshift.m, scripts/general/common_size.m, scripts/general/cplxpair.m, scripts/general/cumtrapz.m, scripts/general/dblquad.m, scripts/general/deal.m, scripts/general/del2.m, scripts/general/display.m, scripts/general/divergence.m, scripts/general/fieldnames.m, scripts/general/flip.m, scripts/general/flipdim.m, scripts/general/fliplr.m, scripts/general/flipud.m, scripts/general/gradient.m, scripts/general/interp3.m, scripts/general/interpft.m, scripts/general/interpn.m, scripts/general/loadobj.m, scripts/general/logspace.m, scripts/general/methods.m, scripts/general/nargchk.m, scripts/general/narginchk.m, scripts/general/nargoutchk.m, scripts/general/nextpow2.m, scripts/general/nthargout.m, scripts/general/num2str.m, scripts/general/pol2cart.m, scripts/general/polyarea.m, scripts/general/postpad.m, scripts/general/prepad.m, scripts/general/profile.m, scripts/general/quadgk.m, scripts/general/quadl.m, scripts/general/quadv.m, scripts/general/randi.m, scripts/general/rat.m, scripts/general/repmat.m, scripts/general/rot90.m, scripts/general/rotdim.m, scripts/general/saveobj.m, scripts/general/shift.m, scripts/general/shiftdim.m, scripts/general/sortrows.m, scripts/general/sph2cart.m, scripts/general/structfun.m, scripts/general/subsindex.m, scripts/general/trapz.m, scripts/general/triplequad.m, scripts/geometry/delaunayn.m, scripts/geometry/dsearch.m, scripts/geometry/dsearchn.m, scripts/geometry/griddata.m, scripts/geometry/griddata3.m, scripts/geometry/griddatan.m, scripts/geometry/inpolygon.m, scripts/geometry/rectint.m, scripts/geometry/tsearchn.m, scripts/geometry/voronoi.m, scripts/geometry/voronoin.m, scripts/help/__unimplemented__.m, scripts/help/doc.m, scripts/help/doc_cache_create.m, scripts/help/get_first_help_sentence.m, scripts/help/help.m, scripts/help/lookfor.m, scripts/help/print_usage.m, scripts/help/type.m, scripts/help/which.m, scripts/image/autumn.m, scripts/image/bone.m, scripts/image/brighten.m, scripts/image/cmpermute.m, scripts/image/colorcube.m, scripts/image/contrast.m, scripts/image/cool.m, scripts/image/copper.m, scripts/image/cubehelix.m, scripts/image/flag.m, scripts/image/gmap40.m, scripts/image/gray.m, scripts/image/gray2ind.m, scripts/image/hot.m, scripts/image/hsv.m, scripts/image/image.m, scripts/image/imagesc.m, scripts/image/imfinfo.m, scripts/image/imformats.m, scripts/image/imread.m, scripts/image/imshow.m, scripts/image/imwrite.m, scripts/image/iscolormap.m, scripts/image/jet.m, scripts/image/lines.m, scripts/image/ntsc2rgb.m, scripts/image/ocean.m, scripts/image/pink.m, scripts/image/prism.m, scripts/image/rainbow.m, scripts/image/rgb2ntsc.m, scripts/image/spinmap.m, scripts/image/spring.m, scripts/image/summer.m, scripts/image/white.m, scripts/image/winter.m: Update docstrings to have one sentence summary as first line. Re-structure to have line lengths <= 80 chars.
author Rik <rik@octave.org>
date Sun, 03 May 2015 09:36:20 -0700
parents 9fc020886ae9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
1 ## Copyright (C) 2012-2015 Rik Wehbring
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
2 ## Copyright (C) 2012-2015 Carnë Draug
14271
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
3 ##
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
4 ## This file is part of Octave.
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
5 ##
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
6 ## Octave is free software; you can redistribute it and/or modify it
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
7 ## under the terms of the GNU General Public License as published by
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
8 ## the Free Software Foundation; either version 3 of the License, or (at
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
9 ## your option) any later version.
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
10 ##
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
11 ## Octave is distributed in the hope that it will be useful, but
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
14 ## General Public License for more details.
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
15 ##
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
16 ## You should have received a copy of the GNU General Public License
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
17 ## along with Octave; see the file COPYING. If not, see
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
18 ## <http://www.gnu.org/licenses/>.
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
19
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
20 ## -*- texinfo -*-
15517
3f1b306e2ba9 rgbplot: return graphics handle if requested
Carnë Draug <carandraug+dev@gmail.com>
parents: 15515
diff changeset
21 ## @deftypefn {Function File} {} rgbplot (@var{cmap})
15713
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
22 ## @deftypefnx {Function File} {} rgbplot (@var{cmap}, @var{style})
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
23 ## @deftypefnx {Function File} {@var{h} =} rgbplot (@dots{})
14271
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
24 ## Plot the components of a colormap.
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
25 ##
15713
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
26 ## Two different @var{style}s are available for displaying the @var{cmap}:
15715
6ae93518356c rgbplot.m. Match variable in docstring to function prototype.
Rik <rik@octave.org>
parents: 15714
diff changeset
27 ##
15713
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
28 ## @table @asis
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
29 ## @item profile (default)
15715
6ae93518356c rgbplot.m. Match variable in docstring to function prototype.
Rik <rik@octave.org>
parents: 15714
diff changeset
30 ## Plot the RGB line profile of the colormap for each of the channels (red,
15713
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
31 ## green and blue) with the plot lines colored appropriately. Each line
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
32 ## represents the intensity of each RGB components across the colormap.
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
33 ##
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
34 ## @item composite
15715
6ae93518356c rgbplot.m. Match variable in docstring to function prototype.
Rik <rik@octave.org>
parents: 15714
diff changeset
35 ## Draw the colormap across the X-axis so that the actual index colors are
6ae93518356c rgbplot.m. Match variable in docstring to function prototype.
Rik <rik@octave.org>
parents: 15714
diff changeset
36 ## visible rather than the individual color components.
15713
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
37 ##
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
38 ## @end table
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
39 ##
15517
3f1b306e2ba9 rgbplot: return graphics handle if requested
Carnë Draug <carandraug+dev@gmail.com>
parents: 15515
diff changeset
40 ## The optional return value @var{h} is a graphics handle to the created plot.
3f1b306e2ba9 rgbplot: return graphics handle if requested
Carnë Draug <carandraug+dev@gmail.com>
parents: 15515
diff changeset
41 ##
15716
e8a4b99f8bd8 Correct typo in docstring in changeset 6ae93518356c.
Ben Abbott <bpabbott@mac.com>
parents: 15715
diff changeset
42 ## Run @code{demo rgbplot} to see an example of @code{rgbplot} and each style
15715
6ae93518356c rgbplot.m. Match variable in docstring to function prototype.
Rik <rik@octave.org>
parents: 15714
diff changeset
43 ## option.
14271
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
44 ## @seealso{colormap}
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
45 ## @end deftypefn
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
46
16472
293f5479a7e7 rgbplot.m: Set the default style to "profile"
Rik <rik@octave.org>
parents: 15716
diff changeset
47 function h = rgbplot (cmap, style = "profile")
14271
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
48
15713
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
49 if (nargin < 1 || nargin > 2)
14271
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
50 print_usage ();
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
51 endif
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
52
15515
4beb3a4bd440 rgbplot.m, cmpermute.m, cmunique.m, ind2rgb.m, imwrite.m: use core iscolormap function
Carnë Draug <carandraug+dev@gmail.com>
parents: 14271
diff changeset
53 if (! iscolormap (cmap))
15714
b1cd65881592 Clean up scripts in image directory.
Rik <rik@octave.org>
parents: 15713
diff changeset
54 error ("rgbplot: CMAP must be a valid colormap");
15713
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
55 elseif (! ischar (style))
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
56 error ("rgbplot: STYLE must be a string");
14271
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
57 endif
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
58
15715
6ae93518356c rgbplot.m. Match variable in docstring to function prototype.
Rik <rik@octave.org>
parents: 15714
diff changeset
59 switch (tolower (style))
15713
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
60 case "profile"
15715
6ae93518356c rgbplot.m. Match variable in docstring to function prototype.
Rik <rik@octave.org>
parents: 15714
diff changeset
61 htmp = plot (cmap(:,1),"r", cmap(:,2),"g", cmap(:,3),"b");
15713
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
62 set (gca, 'ytick', 0:0.1:1);
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
63 case "composite"
15715
6ae93518356c rgbplot.m. Match variable in docstring to function prototype.
Rik <rik@octave.org>
parents: 15714
diff changeset
64 htmp = image (1:rows(cmap));
15713
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
65 set (gca, 'ytick', []);
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
66 colormap (cmap);
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
67 otherwise
16766
7268845c0a1e avoid backquote in error messages, some uses in doc strings
John W. Eaton <jwe@octave.org>
parents: 16472
diff changeset
68 error ("rgbplot: unknown style '%s'", style);
15713
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
69 endswitch
14271
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
70 xlabel ("color index");
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
71
15517
3f1b306e2ba9 rgbplot: return graphics handle if requested
Carnë Draug <carandraug+dev@gmail.com>
parents: 15515
diff changeset
72 if (nargout > 0)
15714
b1cd65881592 Clean up scripts in image directory.
Rik <rik@octave.org>
parents: 15713
diff changeset
73 h = htmp;
15517
3f1b306e2ba9 rgbplot: return graphics handle if requested
Carnë Draug <carandraug+dev@gmail.com>
parents: 15515
diff changeset
74 endif
3f1b306e2ba9 rgbplot: return graphics handle if requested
Carnë Draug <carandraug+dev@gmail.com>
parents: 15515
diff changeset
75
14271
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
76 endfunction
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
77
15715
6ae93518356c rgbplot.m. Match variable in docstring to function prototype.
Rik <rik@octave.org>
parents: 15714
diff changeset
78
14271
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
79 %!demo
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
80 %! clf;
15713
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
81 %! subplot (1, 2, 1);
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
82 %! rgbplot (ocean, "profile");
15715
6ae93518356c rgbplot.m. Match variable in docstring to function prototype.
Rik <rik@octave.org>
parents: 15714
diff changeset
83 %! subplot (1, 2, 2);
15713
168e380c8f18 rgbplot.m: create style option and add new composite style
Carnë Draug <carandraug+dev@gmail.com>
parents: 15518
diff changeset
84 %! rgbplot (ocean, "composite");
14271
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
85
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
86 ## Test input validation
14271
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
87 %!error rgbplot ()
e2a14d1b4eaa rgbplot.m: Add new Matlab compatible function for plotting colormaps
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
88 %!error rgbplot (1,2)
15714
b1cd65881592 Clean up scripts in image directory.
Rik <rik@octave.org>
parents: 15713
diff changeset
89 %!error <CMAP must be a valid colormap> rgbplot ({0 1 0})
16472
293f5479a7e7 rgbplot.m: Set the default style to "profile"
Rik <rik@octave.org>
parents: 15716
diff changeset
90 %!error <STYLE must be a string> rgbplot ([0 1 0], 2)
16766
7268845c0a1e avoid backquote in error messages, some uses in doc strings
John W. Eaton <jwe@octave.org>
parents: 16472
diff changeset
91 %!error <unknown style 'nostyle'> rgbplot ([0 1 0], "nostyle")
15714
b1cd65881592 Clean up scripts in image directory.
Rik <rik@octave.org>
parents: 15713
diff changeset
92