Heatmap labels based on another matrix

4 ビュー (過去 30 日間)
Joris Puttenstein
Joris Puttenstein 2018 年 4 月 3 日
コメント済み: Ranjeet Singh 2024 年 6 月 4 日
Hi
Im trying to get the heatmap function to work with my data. I want to show a different matrix of data as 'text' labels (numbers) on top of my heatmap, but I can't find how to link the new matrix to the heatmap function. I already found the following tutorial, but it doesnt work. It doesnt know 'labels_small'.
I know I have to convert the matrix to a cell with strings:
% matrix for heatmap [2x6]
thermala;
% additional matrix for 'text' labels
c_small = [1 2 3 4 5 6;
1 2 3 4 5 6];
c_label = sprintfc('%d',c_small);
heatmap(thermala);
Thank you in advance.

採用された回答

dpb
dpb 2018 年 4 月 3 日
See the examples; you didn't call it with anything excepting the data array so it can't "know" anything about labels...
  17 件のコメント
dpb
dpb 2018 年 4 月 10 日
Probably the difference, yes. You could probably have both if you were to make a slight rename of the FEX version or explicitly call the one desired if it has features you'd like...or, I presume you just text ed over the existing which is probably almost as simple.
Ranjeet Singh
Ranjeet Singh 2024 年 6 月 4 日
@Joris Puttenstein I would like to know how you finally managed to display information on the heatmap.
Thnak you in advance

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 4 月 8 日
The heatmap function you are looking at is a file exchange contribution, not the same as the Mathworks heatmap function.

カテゴリ

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