% Scale bar
bar_pixels = scale_bar_length / cellsize
for idx = 0 : 0.2*bar_pixels:0.8*bar_pixels,
    rectangle('Position', [size(MAP,2)-bar_pixels - 50 + idx, 15, round(0.1*bar_pixels),10], 'FaceColor','w');
    rectangle('Position', [size(MAP,2)-bar_pixels - 50 + idx + 0.1*bar_pixels, 15, round(0.1*bar_pixels),10], 'FaceColor','k');
    
end
text( size(MAP,2)- bar_pixels - 50 + round(0.4*bar_pixels), 38, barlabel, 'FontWeight', 'bold', 'Color','k');