Problem with surf / pcolor / image
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Image Analyst
am 1 Dez. 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 Kommentare
Weitere Antworten (1)
Bjorn Gustavsson
am 1 Dez. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Lighting, Transparency, and Shading finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!