function M=data2maps(RFn,X,N)
% data2maps - build linear maps for covering data ranges
%
% data2maps :: 
%    ([[N,M]] -> [[2,M]]) ~ 'function to compute min and max of range',
%    [[N,M]]              ~ 'the data'
%    L:natural            ~ 'number of bins in output maps'
% -> { [M] -> dmap(L) }   ~ 'one dmap per column in a cell array'.
%
% Two argument version computes L=sqrt(N)
%
% data2maps :: 
%    ([[N,M]] -> [[2,M]]) ~ 'function to compute min and max of range',
%    [[N,M]]              ~ 'the data'
% -> { [M] -> dmap(L) }   ~ 'one dmap per column in a cell array'.

if nargin<3, N=sqrt(size(X,1)); end
M=maprows(@(r){linmap(r(1),r(2),N)}, closed2hopen(feval(RFn,X)'));

