# HG changeset patch # User Rik # Date 1363877104 25200 # Node ID ca395af72d8871804f86325b86f122736b8e79b4 # Parent b8a4f313e78e016f6ba6966546567042992683e8 hsv.m: Make colormap compatible with Matlab (bug #36473). * scripts/image/hsv.m: Make colormap compatible with Matlab (bug #36473). diff -r b8a4f313e78e -r ca395af72d88 scripts/image/hsv.m --- a/scripts/image/hsv.m Thu Mar 21 07:42:59 2013 -0700 +++ b/scripts/image/hsv.m Thu Mar 21 07:45:04 2013 -0700 @@ -23,7 +23,7 @@ ## It is useful for displaying periodic functions. The map is obtained by ## linearly varying the hue through all possible values while keeping constant ## maximum saturation and value. The equivalent code is -## @code{hsv2rgb ([linspace(0,1,N)', ones(N,2)])}. +## @code{hsv2rgb ([(0:N-1)'/N, ones(N,2)])}. ## ## The argument @var{n} must be a scalar. ## If unspecified, the length of the current colormap, or 64, is used. @@ -50,7 +50,7 @@ if (n == 1) map = [1, 0, 0]; elseif (n > 1) - hue = linspace (0, 1, n)'; + hue = [0:n-1]' / n; map = hsv2rgb ([hue, ones(n,1), ones(n,1)]); else map = zeros (0, 3);