colormap(rgb); n = size(rgb, 1); indices = cumsum( ones(n,1) ); scatter(data(:,1), data(:,2), size, indices, 'filled');