在Matlab中创建相关图

zpe*_*esk 9 graphics matlab plot correlation

我试图模仿这个图: 在此输入图像描述

如果我有一个相关矩阵,我该如何创建这样的输出?

bla*_*rat 6

如果您有一个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中央文件交换包含一些解决方案.