How to remove colorbar and heatmap black borders?

조회 수: 341 (최근 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 CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by