フィルターのクリア

How to set the max and min value of the colorbar to be displayed on a Heatmap on Matlab 2015

19 ビュー (過去 30 日間)
Hi, i need something similar. I used HeatMap function ad i obtained the two charts in attachment. The max values for the two charts are 1 an 0.857. On the two charts the maxi values (1 and 0.857) have the same color green. I need to rescale the second chart to the maximum value 1 in order to obtain the same colours for the same values in the two charts.
  6 件のコメント
Adam Danz
Adam Danz 2021 年 1 月 7 日
caxis does work with HeatMap (and heatmap).
I just noticed that you're using matlab 2015 after writing my answer. I filled in your version info in the Produce/Release panels to the right; are you using r2015a or b?. In the future, remember that it's very important to provide your matlab release info for clear communication and to save time.
Domenico Lucia
Domenico Lucia 2021 年 1 月 8 日
thank you for the instruction. Next time i will be more accurate

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

採用された回答

Adam Danz
Adam Danz 2021 年 1 月 7 日
編集済み: Adam Danz 2021 年 1 月 7 日
You're using the older HeatMap from the bioinformatics toolbox.
Instead, use heatmap which supports caxis().
If you have a good reason to continue using HeatMap instead, follow this demo to gain access to the axis handle and apply caxis.
HeatMap(magic(9));
ax = findall(0,'Type','Axes','Tag','HeatMapAxes');
caxis(ax, [20,30])
Add a colorbar,
colorbar(ax)
Note other alternatives to heatmap/HeatMap that are supported by older releases of Matlab.
  2 件のコメント
Domenico Lucia
Domenico Lucia 2021 年 1 月 8 日
Thank you adam, the script works very well with HeatMap
Adam Danz
Adam Danz 2021 年 1 月 8 日
Glad I could help. Note that if more than 1 HeatMap exists the findall command will list all HeatMap axes.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

製品


リリース

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by