我正在尝试模拟此图:
如果我有一个相关矩阵,我该如何创建这样的输出?
最佳答案
如果您有一个 n x n
相关矩阵 M
和一个长度为 n
的向量 L
包含标签对于每个 bin,您可以使用如下内容:
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
旋转 x 轴标签并不简单,但 MATLAB 中央文件交换包含 some solutions .
关于matlab - 在 Matlab 中创建相关图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10388940/