brewermap.m 785 Bytes
function result = stimBrewerColormap(R)

%returns a Brewer colormap with the specified resolution R

ctrlPts = zeros(11, 3);

ctrlPts(1, :) = [0.192157, 0.211765, 0.584314];
ctrlPts(2, :) = [0.270588, 0.458824, 0.705882];
ctrlPts(3, :) = [0.454902, 0.678431, 0.819608];
ctrlPts(4, :) = [0.670588, 0.85098, 0.913725];
ctrlPts(5, :) = [0.878431, 0.952941, 0.972549];
ctrlPts(6, :) = [1, 1, 0.74902];
ctrlPts(7, :) = [0.996078, 0.878431, 0.564706];
ctrlPts(8, :) = [0.992157, 0.682353, 0.380392];
ctrlPts(9, :) = [0.956863, 0.427451, 0.262745];
ctrlPts(10, :) = [0.843137, 0.188235, 0.152941];
ctrlPts(11, :) = [0.647059, 0, 0.14902];

X = 1:11;

r = 1:11/R:11;

R = interp1(X, ctrlPts(:, 1), r);
G = interp1(X, ctrlPts(:, 2), r);
B = interp1(X, ctrlPts(:, 3), r);

result = [R' G' B'];