# HG changeset patch # User Carnë Draug # Date 1350158001 -7200 # Node ID 3f1b306e2ba94ae02d7b9e4a438bb4cc96fb473a # Parent 271f0a2d15ab26bcb8e1438a4bfa48f8874f119c rgbplot: return graphics handle if requested diff -r 271f0a2d15ab -r 3f1b306e2ba9 scripts/image/rgbplot.m --- a/scripts/image/rgbplot.m Fri Oct 12 17:12:53 2012 -0700 +++ b/scripts/image/rgbplot.m Sat Oct 13 21:53:21 2012 +0200 @@ -17,16 +17,20 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} rgbplot (@var{cmap}) +## @deftypefn {Function File} {} rgbplot (@var{cmap}) +## @deftypefnx {Function File} {@var{h} =} rgbplot (@dots{}) ## Plot the components of a colormap. ## ## The first column is plotted in red, the second column in green, and ## the third column in blue. The values are between 0 and 1 and represent ## the intensity of the RGB components in the given indexed color. +## +## The optional return value @var{h} is a graphics handle to the created plot. +## ## @seealso{colormap} ## @end deftypefn -function rgbplot (cmap) +function retval = rgbplot (cmap) if (nargin != 1) print_usage (); @@ -36,10 +40,14 @@ error ("rgbplot: CMAP must be a colormap"); endif - plot (cmap(:,1),"r", cmap(:,2),"g", cmap(:,3),"b"); + h = plot (cmap(:,1),"r", cmap(:,2),"g", cmap(:,3),"b"); set (gca, 'ytick', 0:0.1:1); xlabel ("color index"); + if (nargout > 0) + retval = h; + endif + endfunction