MATLAB Answers


How to make heatmap y-axis based on column names, not column values

Asked by a1
on 27 Aug 2019
Latest activity Commented on by a1
on 28 Aug 2019
Accepted Answer by dpb
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:
Desired output looks like:


Sign in to comment.


1 Answer

Answer by dpb
on 28 Aug 2019
Edited by dpb
on 28 Aug 2019
 Accepted Answer

data = [0 280 1170 0; 62 0 0 0];
VariableNames = {'colA', 'colB', 'colC', 'colD'};
rowid= {'rowA', 'rowB'};
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.

  1 Comment

Sign in to comment.