%CHESSBOARD Function that defines a chessboard. % % Thorsten Hansen 2008-04-11 function cb = chessboard white_field = ones(4); black_field = zeros(4); bw2 = [white_field black_field; black_field white_field]; cb = repmat(bw2, 4, 4); % show the board imshow(cb) % use imagesc(cb) if you do not have the Image Toolbox h = title('chessboard'); set(h, 'Fontsize', 20) % with axes ticks axis on box off set(gca, 'Fontsize', 20) tickpos = 2.5:4:8*4+2.5; % where to put the ticks, x- and y-ticks set(gca, 'XTick', tickpos); %set(gca, 'XTickLabel', ['a'; 'b'; 'c'; 'd'; 'e'; 'f'; 'g'; 'h']) % use char and double instead: set(gca, 'XTickLabel', char([double('a'):double('a')+7]')) set(gca, 'YTick', tickpos); set(gca, 'YTickLabel', [8:-1:1]); set(gca, 'YAxisLocation', 'right');