How to change the shape/size of a HeatMap/clustergram?

19 ビュー (過去 30 日間)
Ziwei Liu
Ziwei Liu 2021 年 6 月 24 日
回答済み: Clara 2022 年 9 月 26 日
Hi, I'm working on a data with a 8 by 53 matrix, and I'm trying to generate a heatmap using the HeatMap function. The figure turns out to be undesirable since each block is a thin, long rectangle. I know it's probably due to the size of the input data so the function automatically scaled the figure so that the entire image looks like a square. I guess if I had a 50 by 50 matirx, each block may be a square and the image may be more good-looking, but I can't change the data I have. So, are there any way to overcome this? Thanks.

採用された回答

Clara
Clara 2022 年 9 月 26 日
Maybe you can control the size of the graph using:
set(gcf, 'Position', [x, y, horizontal length, vertical length]).
For a 5 by 41 matrix, set(gcf, 'Position', [100, 100, 1000, 200]) works well for me.
Hope it is helpful!

その他の回答 (1 件)

KSSV
KSSV 2021 年 6 月 24 日
編集済み: KSSV 2021 年 6 月 24 日
You can use imresize, interp2 functions to get your desired dimensions.
If A is your 8*53 matrix.
A_new = imresize(A,[50 50]) ;
But still I suspect that will you get squares.
  1 件のコメント
Ziwei Liu
Ziwei Liu 2021 年 6 月 25 日
Hi KSSV,
Thanks for your answer, but I don't want to change my input data. I just want to set the properties of the image, if possible.

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by