How to remove colorbar and heatmap black borders?

298 ビュー (過去 30 日間)
Zeynab Mousavikhamene
Zeynab Mousavikhamene 2020 年 12 月 1 日
回答済み: Sophia Snipes 2022 年 8 月 3 日
I need to remove colorabar and heatmap blck borders. Any idea?

採用された回答

Benjamin Kraus
Benjamin Kraus 2020 年 12 月 2 日
編集済み: Benjamin Kraus 2022 年 3 月 2 日
If you want to remove the colorbar, you can set the ColorbarVisible property to 'off':
h = heatmap(magic(5));
h.ColorbarVisible = 'off';
Alternatively, use the colorbar command:
heatmap(magic(5))
colorbar off
To turn off the grid lines, you can either set the GridVisible property on heatmap:
h = heatmap(magic(5));
h.GridVisible = 'off';
or use the grid command:
heatmap(magic(5))
grid off
Heatmap does not provide any control over the outer border around the outside of the heatmap, or the color or thickness of the line, so if you want to change those things you will have to switch to a lower-level function like image or surface.
  3 件のコメント
Benjamin Kraus
Benjamin Kraus 2021 年 7 月 12 日
Heatmap does not provide any control over the tick labels on the colorbar. If you want control over those labels, you will have to switch to a lower-level function like imagesc or surface.
Koosha
Koosha 2022 年 4 月 23 日
Thank u

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

その他の回答 (2 件)

Yue
Yue 2022 年 3 月 2 日
h.GridVisible = 'off';
This will work to remove black borders.
  1 件のコメント
Benjamin Kraus
Benjamin Kraus 2022 年 3 月 2 日
Thank you for reminding me about that. I've updated my answer above to reflect that you can set the GridVisible property. You can also use the grid command:
grid off

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


Sophia Snipes
Sophia Snipes 2022 年 8 月 3 日
For removing the black border of the colobar:
set(colorbar, 'Color', 'none')

カテゴリ

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