Trying to Customize a heatmap color bar and thresholds

28 ビュー (過去 30 日間)
blue_Steel
blue_Steel 2022 年 9 月 7 日
コメント済み: blue_Steel 2022 年 9 月 7 日
Hi,
I'm trying to create a heatmap but I only want to it to show color if the value is either above 10 or below -10. Otherwise it will just be white if it's within this 'dead zone'.
Additionally I'd like to have different colors for values above 10 and yet another color for values below -10.
Is there a way to customize the colormap for something like this?
Thanks

採用された回答

Kevin Holly
Kevin Holly 2022 年 9 月 7 日
編集済み: Kevin Holly 2022 年 9 月 7 日
m=30*rand(30)-15;
surf(m,'FaceColor','interp')
cmap = [1 0 0; 1 1 1;1 1 1; 1 1 1; 1 1 1; 0 0 1];
colorbar
caxis([-15 15])
colormap(cmap);
figure
imagesc(m)
c=colorbar;
c.Limits = [-15 15];
colormap(cmap);
  1 件のコメント
blue_Steel
blue_Steel 2022 年 9 月 7 日
Excellent, that'll do the trick.
Thanks!

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by