How to remove colorbar and heatmap black borders?

308 vues (au cours des 30 derniers jours)
Zeynab Mousavikhamene
Zeynab Mousavikhamene le 1 Déc 2020
I need to remove colorabar and heatmap blck borders. Any idea?

Réponse acceptée

Benjamin Kraus
Benjamin Kraus le 2 Déc 2020
Modifié(e) : Benjamin Kraus le 2 Mar 2022
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:
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:
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 commentaires
Koosha le 23 Avr 2022
Thank u

Connectez-vous pour commenter.

Plus de réponses (2)

Yue le 2 Mar 2022
h.GridVisible = 'off';
This will work to remove black borders.
  1 commentaire
Benjamin Kraus
Benjamin Kraus le 2 Mar 2022
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

Connectez-vous pour commenter.

Sophia Snipes
Sophia Snipes le 3 Août 2022
For removing the black border of the colobar:
set(colorbar, 'Color', 'none')


En savoir plus sur Data Distribution Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by