フィルターのクリア

Problem with surf / pcolor / image

10 ビュー (過去 30 日間)
Michael
Michael 2011 年 12 月 1 日
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

採用された回答

Image Analyst
Image Analyst 2011 年 12 月 1 日
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.

その他の回答 (1 件)

Bjorn Gustavsson
Bjorn Gustavsson 2011 年 12 月 1 日
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

カテゴリ

Help Center および File ExchangeRead, Write, and Modify Image についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by