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

15 ビュー (過去 30 日間)
newbie9
newbie9 2019 年 8 月 27 日
コメント済み: newbie9 2019 年 8 月 28 日
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
Desired output looks like:
Capture.PNG

採用された回答

dpb
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 ExchangeData Distribution Plots についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by