How to make heatmap y-axis based on column names, not column values
10 次查看(过去 30 天)
显示 更早的评论
How can I make a heat map based on the values in the column names in a table?
For example, if I have this table:
myTable = [0 280 1170 0; 62 0 0 0];
myTable = array2table(myTable);
myTable.Properties.VariableNames = {'colA', 'colB', 'colC', 'colD'};
myTable.rowid(:) = {'rowA', 'rowB'};
Which looks like this:
![Capture.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/235504/Capture.png)
Desired output looks like:
![Capture.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/235505/Capture.png)
0 个评论
采纳的回答
dpb
2019-8-28
编辑:dpb
2019-8-28
data = [0 280 1170 0; 62 0 0 0];
VariableNames = {'colA', 'colB', 'colC', 'colD'};
rowid= {'rowA', 'rowB'};
hHM=heatmap(rowid,VariableNames,data.','ColorbarVisible','off');
seems to do the trick.
Looks more difficult (but probably still possible with judicious selection of parameters and data from the table) after in the table than with the raw data.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!