Problem with surf / pcolor / image
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi
I have a matrix and I want a pcolor-style plot where each square (and therefore its colour) corresponds to an element. Currently each vertex corresponds to an element, so my images are getting distorted.
I'm trying to use image, but it's proving to be a very difficult function to manage- all I get is tiny plots of completely white images.
Is there a way to make a pcolor style image (ie. easy to manipulate without having to scale/resize which itself adds errors), only where the pixel colors are taken from individual elements of a matrix?
Thanks Mike
0 comentarios
Respuesta aceptada
Image Analyst
el 1 de Dic. de 2011
You can use image, imagesc, or imshow (my preference). As you've probably found out, each square in pcolor does not correspond to an element in your array and the same element value will show up in different colors depending on where it is located. That is why I never ever use pcolor for displaying images.
0 comentarios
Más respuestas (1)
Bjorn Gustavsson
el 1 de Dic. de 2011
Use something like this:
pcolor(x,y,I),shading flat
That should give you your I with constant intensities for each pixel - or rather constant intensities for pixels I(1:end-1,1;end-1) with pixel I(i1,i2) mapped out to the patch with corners at:
[x([i1 i1 i1+1 i1+1],[i2 i2+1 i2+1 i2]);
y([i1 i1 i1+1 i1+1],[i2 i2+1 i2+1 i2])]
If you can survive without the last rrow and column this should be OK.
HTH
0 comentarios
Ver también
Categorías
Más información sobre Lighting, Transparency, and Shading 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!