7 Star 46 Fork 11

slandarer/MATLAB Special Heatmap

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
demo10_Multilayer.m 1.47 KB
一键复制 编辑 原始数据 按行查看 历史
slandarer 提交于 2023-03-17 13:24 . add & push by Matlab
% 多层分组(Multilayer grouping)
Data=rand(3,16);
Class1=[1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4];
Class2=[1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4];
ClassName1={'AAAAA','BBBBB','CCCCC','DDDDD'};
ClassName2={'A1','A2','A3','A4','B1','B2','B3','B4','C1','C2','C3','C4','D1','D2','D3','D4'};
% 设置颜色(Set Color)
CList1=[0.7020 0.8863 0.8039
0.9559 0.8142 0.6907
0.8451 0.8275 0.8510
0.8966 0.8083 0.9000];
CList2=[0.4588 0.4196 0.6941
0.6196 0.6039 0.7843
0.7373 0.7412 0.8627
0.8549 0.8549 0.9216];
% 图窗及坐标区域创建(create figure and axes)
fig=figure('Position',[100,100,1000,320]);
axMain=axes('Parent',fig);
axMain.Position=[.05,0,.9,.78];
P=axMain.Position;
% Draw Heatmap
SHM5=SHeatmap(Data,'Format','sq','Parent',axMain);
SHM5=SHM5.draw();
CB=colorbar;
CB.Location='southoutside';
axMain.DataAspectRatioMode='auto';
% Draw Block
axBlockT=axes('Parent',fig);
axBlockT.Position=[P(1),P(2)+P(4)*1.05,P(3),P(4)/5];
[X1,Y1]=SClusterBlock(Class1,'Orientation','top','Parent',axBlockT,'MinLim',1,'ColorList',CList1);
[X2,Y2]=SClusterBlock(Class2,'Orientation','top','Parent',axBlockT,'ColorList',CList2);
% text
for i=1:length(X1)
text(axBlockT,X1(i),Y1(i),ClassName1{i},'FontSize',17,'HorizontalAlignment','center','FontName','Cambria')
end
for i=1:length(X2)
text(axBlockT,X2(i),Y2(i),ClassName2{i},'FontSize',17,'HorizontalAlignment','center','FontName','Cambria')
end
% exportgraphics(gcf,'gallery\Multilayer.png')
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Matlab
1
https://gitee.com/slandarer/matlab-special-heatmap.git
[email protected]:slandarer/matlab-special-heatmap.git
slandarer
matlab-special-heatmap
MATLAB Special Heatmap
master

搜索帮助