function map = rvaluemap(n,f)
% rvaluemap(n,f) redblue colormap with N entries but the first f*n 
% entries are set to grey.
% Useful for plotting ROMS bathymetry r-value.
% If you choose caxis([0 1]) and colormap(rvaluemap) the less than 0.2
% values will come out grey 
%
% See also redblue, pixcmap, phasemap, clmap rscolmap, zebra, cmap5,
% makecmap
%
% John Wilkin


if nargin == 0
  n = size(colormap,1);
end
if nargin < 2
  f = 1/5;
end

n = n+1;
n = 2*round(n/2);

b(1:n/2) =  1;
b(n/2+1:n) = 1-linspace(0,1,n/2);

r(1:n/2) = 1-linspace(1,0,n/2);
r(n/2+1:n) = 1;

g(1:n/2) = r(1:n/2);
g(n/2+1:n) = b(n/2+1:n);

map = [r; g; b]';

% remove the duplicated color entry in the middle
map([2 n/2],:,:) = [];

nm2 = n-2;
map(1:floor(nm2*f),:) = 0.8*ones([floor(nm2*f) 3]);
