Borrar filtros
Borrar filtros

change tick values heat map

10 visualizaciones (últimos 30 días)
Roja Eliza
Roja Eliza el 30 de Jun. de 2022
Comentada: Roja Eliza el 13 de Jul. de 2022
I want to set ticks to my heat map figure. I don't find any options to do it. It has automatically set it with numbers. also I want to add subscripts to the values inside the boxes.

Respuesta aceptada

Chunru
Chunru el 1 de Jul. de 2022
It seems that "heatmap" has no properties for changing display text. You can use imagesc instead:
data = rand(4);
imagesc(data); colorbar
h = gca;
h.XTick= 1:4;
h.XTickLabel = ["A", "B", "C", "D"];
[xx, yy] = meshgrid(1:4, 1:4);
str = string(data(:));
str(1) = str(1)+"^B"; % Now you can specify the text anyway you like. This is an example
text(xx(:), yy(:), str, 'HorizontalAlignment', 'center')
  4 comentarios
Chunru
Chunru el 13 de Jul. de 2022
Editada: Chunru el 13 de Jul. de 2022
try colormap(jet) or colormap(hot)
doc colormap for more help
Roja Eliza
Roja Eliza el 13 de Jul. de 2022
what you have mentioned are in built color codes. I want the color grading to be from red to blue as given in my first picture. aslo with this code I am unable to make the background colour to be white instead of blue( grids with zero values). with heat map i used a file exchange but for this the exchange is not working

Iniciar sesión para comentar.

Más respuestas (1)

Chunru
Chunru el 30 de Jun. de 2022
cdata = rand(3,3);
h = heatmap(cdata);
h.XData = ["A", "B", "C"];
h.YData = ["A_1", "B_1", "C_1"];
  3 comentarios
Chunru
Chunru el 30 de Jun. de 2022
Can you explain what you want exactly?
Roja Eliza
Roja Eliza el 30 de Jun. de 2022
I want to insert letters or numbers as power of the numbers as in picture

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by