-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdemo1_BasicUsage.m
More file actions
80 lines (63 loc) · 1.85 KB
/
Copy pathdemo1_BasicUsage.m
File metadata and controls
80 lines (63 loc) · 1.85 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
%% Basic usage
% Basic usage (基础使用)
% if ~exist('gallery\','dir')
% mkdir('gallery\')
% end
%% Draw positive heatmap (绘制无负数的热图)
figure()
Data = rand(15, 15);
SHM1 = SHeatmap(Data, 'Format','sq');
SHM1.draw();
drawnow
%% Contains negative numbers (绘制有负数热图)
figure()
Data = rand(15, 15) - .5;
SHM2 = SHeatmap(Data, 'Format','sq');
SHM2.draw();
drawnow
%% Draw heatmaps of different sizes (绘制不同大小热图)
figure()
Data = rand(25, 30);
SHM3 = SHeatmap(Data, 'Format','sq');
SHM3.draw();
drawnow
%% Adjust the colorbar Location (调整colorbar位置)
figure()
Data = rand(3, 12);
SHM4 = SHeatmap(Data, 'Format','sq');
SHM4.draw();
CB = colorbar;
CB.Location = 'southoutside';
drawnow
%% Draw heatmap with NaN (绘制有NaN热图)
figure()
Data = rand(12, 12) - .5;
Data([4, 5, 13]) = nan;
SHM5 = SHeatmap(Data, 'Format','sq');
SHM5.draw();
drawnow
%% Draw heatmap with texts (绘制有文本热图)
figure()
Data = rand(12, 12) - .5;
Data([4, 5, 13]) = nan;
SHM6 = SHeatmap(Data, 'Format','sq');
SHM6.draw();
SHM6.setText();
drawnow
%% Draw heatmap with labels by XTick and YTick (绘制带标签热图, 使用 axes 原本的 XY 刻度)
figure()
Data = rand(12, 12);
SHM7 = SHeatmap(Data, 'Format','sq');
SHM7.draw();
SHM7.ax.XTickLabel = {'X-1','X-2','X-3','X-4','X-5','X-6','X-7','X-8','X-9','X-10','X-11','X-12'};
SHM7.ax.YTickLabel = {'Y-1','Y-2','Y-3','Y-4','Y-5','Y-6','Y-7','Y-8','Y-9','Y-10','Y-11','Y-12'};
drawnow
%% Draw heatmap with labels by RowName and ColName (绘制带标签热图, 使用 SHeatmap 的行列标签功能)
figure()
Data = rand(12, 12);
SHM8 = SHeatmap(Data, 'Format','sq');
SHM8.ColName = {'X-1','X-2','X-3','X-4','X-5','X-6','X-7','X-8','X-9','X-10','X-11','X-12'};
SHM8.RowName = {'Y-1','Y-2','Y-3','Y-4','Y-5','Y-6','Y-7','Y-8','Y-9','Y-10','Y-11','Y-12'};
SHM8.draw();
SHM8.setFrame()
drawnow