changeset 15715:6ae93518356c

rgbplot.m. Match variable in docstring to function prototype. * rgb2ind.m: Use Octave coding convention for parenthesis around switch arg. * rgbplot.m: Match variable in docstring to function prototype. Tweak docstring. Use Octave coding convention for parenthesis around switch arg.
author Rik <rik@octave.org>
date Sun, 02 Dec 2012 10:17:46 -0800
parents b1cd65881592
children e8a4b99f8bd8
files scripts/image/rgb2ind.m scripts/image/rgbplot.m
diffstat 2 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/image/rgb2ind.m	Sun Dec 02 10:02:57 2012 -0800
+++ b/scripts/image/rgb2ind.m	Sun Dec 02 10:17:46 2012 -0800
@@ -58,7 +58,7 @@
   x      = reshape (x, size (R));
 
   ## a colormap is of class double and values between 0 and 1
-  switch class (R)
+  switch (class (R))
     case {"single", "double", "logical"}
       ## do nothing, return the same
     case {"uint8", "uint16"}
--- a/scripts/image/rgbplot.m	Sun Dec 02 10:02:57 2012 -0800
+++ b/scripts/image/rgbplot.m	Sun Dec 02 10:17:46 2012 -0800
@@ -24,26 +24,27 @@
 ## Plot the components of a colormap.
 ##
 ## Two different @var{style}s are available for displaying the @var{cmap}:
+##
 ## @table @asis
 ## @item profile (default)
-## Plots the RGB line profile of the colormap for each of the channels (red,
+## Plot the RGB line profile of the colormap for each of the channels (red,
 ## green and blue) with the plot lines colored appropriately.  Each line
 ## represents the intensity of each RGB components across the colormap.
 ##
 ## @item composite
-## Draws the colormap across the X axis so that the actual colors are visible
-## rather than the individual color components.
+## Draw the colormap across the X-axis so that the actual index colors are
+## visible rather than the individual color components.
 ##
 ## @end table
 ##
-## Run @code{demo rgbplot} for a comparison display.
-##
 ## The optional return value @var{h} is a graphics handle to the created plot.
 ##
+## Run @code{demo rgbplot} to see an example of @cdoe{rgpblot} and each style
+## option.
 ## @seealso{colormap}
 ## @end deftypefn
 
-function retval = rgbplot (cmap, style)
+function h = rgbplot (cmap, style)
 
   if (nargin < 1 || nargin > 2)
     print_usage ();
@@ -55,12 +56,12 @@
     error ("rgbplot: STYLE must be a string");
   endif
 
-  switch tolower (style)
+  switch (tolower (style))
     case "profile"
-      h = plot (cmap(:,1),"r", cmap(:,2),"g", cmap(:,3),"b");
+      htmp = plot (cmap(:,1),"r", cmap(:,2),"g", cmap(:,3),"b");
       set (gca, 'ytick', 0:0.1:1);
     case "composite"
-      h = image (1:rows(cmap));
+      htmp = image (1:rows(cmap));
       set (gca, 'ytick', []);
       colormap (cmap);
     otherwise
@@ -74,11 +75,12 @@
 
 endfunction
 
+
 %!demo
 %! clf;
 %! subplot (1, 2, 1);
 %! rgbplot (ocean, "profile");
-%! subplot (1, 2, 2)
+%! subplot (1, 2, 2);
 %! rgbplot (ocean, "composite");
 
 %% Test input validation