How to hide the value of each matrix in heatmap?

39 visualizaciones (últimos 30 días)
H.Zheng
H.Zheng el 10 de Sept. de 2020
Respondida: Diego Campos el 28 de Dic. de 2021
In Matlab the heatmap always show the value of each cell, I am wandering how to hide the value of each matrix in heatmap just like below? Thanks
  1 comentario
H.Zheng
H.Zheng el 11 de Sept. de 2020
I use 'CellLabelColor' function to solve this problem.
h=heatmap(C, 'CellLabelColor', 'None');
%% C is the matrix you need
Hope it works for you.

Iniciar sesión para comentar.

Respuestas (2)

Ameer Hamza
Ameer Hamza el 10 de Sept. de 2020
Editada: Ameer Hamza el 10 de Sept. de 2020
There does not seem to be a documented way to do this using heatmap. However, you can get something similar using pcolor(). For example
f = figure();
x = rand(20);
pcolor(x)
% show value for randomly selected 30 squares
rows = randi([1 size(x, 1)-1], 30, 1);
cols = randi([1 size(x, 2)-1], 30, 1);
idx = sub2ind(size(x), rows, cols);
vals = x(idx);
texts = num2str(vals, '%.1f');
text(cols + 0.5, rows + 0.5, texts, ...
'HorizontalAlignment', 'center')

Diego Campos
Diego Campos el 28 de Dic. de 2021
Try to set de 'FontSize' to zero:
H = heatmap(...,'FontSize',0);
It worked for me.

Categorías

Más información sobre Data Distribution Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by