matrix values as text on plot
18 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Paul
el 23 de Feb. de 2012
Comentada: Saeed Bello
el 20 de Dic. de 2016
Hello all,
I don't really know how to ask this question, but I'll try my best.
From a 20*20 matrix I used griddata and then pcolor to plot a figure just like this one:
I now would like to insert the matrix as text on top of the figure (just like you can see in the link above).
Of course I can use the "text" function and insert all the values one by one. But I'm sure there is an easyer way to do it!
I tried using clabel, but I couldn't find a way to label all the matrix values.
Your help would be much appreciated!
Paul
0 comentarios
Respuesta aceptada
Andrew Newell
el 23 de Feb. de 2012
You could do all the text commands in a loop, for example:
A = randn(20);
x = linspace(0,1,20); y = x;
pcolor(x,y,A); colormap summer
for ii=4:4:16
for jj = 4:4:16
text(x(ii),y(jj),num2str(A(ii,jj),2))
end
end
Más respuestas (1)
fei
el 28 de En. de 2015
Hi Paul.
i'm facing the same problem.
Can you kindly share with me how do you overcome it?
Thank you in advance
1 comentario
Saeed Bello
el 20 de Dic. de 2016
The answer has been answered by Mathswork Support team on the link below: https://www.mathworks.com/matlabcentral/answers/91384-how-can-i-display-the-numerical-values-of-each-cell-as-text-in-my-pcolor-plot
Ver también
Categorías
Más información sobre Labels and Styling 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!