-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdemo16_3_XYT_45_Tree.m
More file actions
28 lines (24 loc) · 994 Bytes
/
Copy pathdemo16_3_XYT_45_Tree.m
File metadata and controls
28 lines (24 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
%% Rotated triangular heatmap with dendrogram
rng(1)
% Made up some data casually (随便捏造了点数据)
X = randn(20, 20) + [(linspace(-1, 2.5, 20)').*ones(1, 8), ...
(linspace(.5, -.7, 20)').*ones(1, 5),...
(linspace(.9, -.2, 20)').*ones(1, 7)];
Data = corr(X);
labels = compose('Slan-%d', 1:20);
fig = figure('Units','normalized', 'Position',[.1,.05,.5,.7]);
ax = axes('Parent',fig, 'Position',[.1,.1,.8,.8]);
% Draw dendrogram (绘制树状图)
SD = SDendrogram(ax, Data, 'Orientation','top', 'BasePos',.5, 'Height',5);
order = SD.draw();
SD.setXYTLim('TLim', [pi/4, pi/4]);
% Exchange data order (交换数据顺序)
Data = Data(order, order);
% Draw rotated triangular heatmap (绘制旋转三角热图)
SHM = SHeatmap(ax, Data, 'Format','sq', 'VarName',labels(order));
SHM.draw();
SHM.setType('triu');
SHM.setRowLabelLocation('right')
SHM.setColTickIndices([])
SHM.setXYTLim('TLim',[pi/4, pi/4]);
SHM.Colorbar.Location = 'southoutside';