Adding numeric values to imagesc
Mostrar comentarios más antiguos
How do I display the actual numeric values of a matrix plotted using 'imagesc'? I would like to have a number displayed in each colored box, representing a value of row and column plotted using 'imagesc' function.
Respuestas (3)
Image Analyst
el 31 de Mzo. de 2015
0 votos

4 comentarios
Image Analyst
el 31 de Mzo. de 2015
What is the "value of the matrix inside" if it's not the gray level or RGB information? You cannot build this capability into imagesc() or imshow() since those are built-in functions that you don't want to mess with.
Tasi
el 31 de Mzo. de 2015
Image Analyst
el 31 de Mzo. de 2015
imagesc() displays pixels. There is no way you can fit all of that into a single pixel and see it on your screen, not even with a microscope. The only way is to blow up the pixels to big patches like I showed you with the im2html program.
Tamar Regev
el 27 de Feb. de 2024
0 votos
Just use the text function:
M = [1,2,3;4,5,6;7,8,9];
figure
figure
imagesc([1:3],[1:3],M)
set(gca,'XTick',[1:3],'YTick',[1:3],'fontsize',20)
for i = 1:3
for j = 1:3
text(i,j,num2str(M(i,j)),'FontSize',20)
end
end
Steven Lord
el 27 de Feb. de 2024
0 votos
This function didn't exist when the question was originally asked, but I suspect the original poster had something like heatmap (introduced in release R2017a) in mind.
1 comentario
Tamar Regev
el 27 de Feb. de 2024
gotcha! Good thing that this function exists now :)
Categorías
Más información sobre Data Distribution Plots en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!