记2021年美赛A题数字热力图绘制Matlab代码实现
clearvars; clc; % thermo_chart
target_path = 'D:\SJTU大三(上)总\杂项\科研项目\2021MCM\regulation_test\figures\heat_map\efficiency_heat_map.png';
heat_chart_tabel = readtable('D:\SJTU大三(上)总\杂项\科研项目\2021MCM\regulation_test\data\raw data\xlsx format\numerical.xlsx');
tbl = heat_chart_tabel;
clear heat_chart_tabel;
heat_map = heatmap(tbl, 'types', 'environment', 'ColorVariable', 'efficiency');
clear tbl;
heat_map.XDisplayData = {'A', 'O', 'S', 'A+O', 'A+S', 'A+S+O'};
heat_map.YDisplayData = {'arid','semi-arid',' temperate','arboreal',' tropical'};
heat_map.Title = 'Reproduction Rate';
heat_map.YLabel = ''; heat_map.XLabel = '';
heat_map.FontSize = 12;
saveas(gcf, target_path); clear target_path; close all;
效果图

本文介绍了使用Matlab绘制数字热力图的方法,并提供了具体的代码实现过程。通过读取Excel文件中的数据,利用heatmap函数创建了热力图,并对X轴、Y轴的数据进行了定制化展示。
7263

被折叠的 条评论
为什么被折叠?



