如果您有一个n x n
相关矩阵M
,以及包含每个bin的标签L
的长度向量n
,您可以使用以下内容:
imagesc(M); % plot the matrix
set(gca, 'XTick', 1:n); % center x-axis ticks on bins
set(gca, 'YTick', 1:n); % center y-axis ticks on bins
set(gca, 'XTickLabel', L); % set x-axis labels
set(gca, 'YTickLabel', L); % set y-axis labels
title('Your Title Here', 'FontSize', 14); % set title
colormap('jet'); % set the colorscheme
colorbar on; % enable colorbar
Run Code Online (Sandbox Code Playgroud)
旋转x轴标签并非易事,但MATLAB中央文件交换包含一些解决方案.