And as a further question am I right in saying, to plot a matrix using Cartesian convention, it is necessary to write "imshow(flipud(I'));" ? And the transpose must be inside the second bracket?
imshow / pcolor ... inconsistent plotting
6 次查看(过去 30 天)
显示 更早的评论
Hi
Just asking to confirm something as I have never noticed this before and it's confusing me a bit. I'll use a simple example matrix; I = zeros(100); I(10:20,45:55) = 1; imshow(I) figure; pcolor(I);
In my geometry I'm using a matrix to represent (x,y) Cartesian coordinates which are represented by rightward,upward increasing coordinates, respectively. inshow appears to flip x/y and also flip the matrix up/down before plotting, and pcolor appears to just flip x/y. Is this correct?
I've been trying to fix a problem for a while, all the time not knowing that these two imagine options return different results! If my above statement is correct then I should hope that I have no actual coding problem at all.
Thanks very much, if anyone more familiar with this than me can confirm it. Mike
2 个评论
Image Analyst
2012-5-29
No, you're better off reversing the standard image direction to be the Cartesian direction using the ydir property:
set(gca, 'YDir', 'reverse');
That way you don't waste time creating a new array that is flipped just for display.
采纳的回答
Image Analyst
2012-5-29
imshow() does not flip vertically. It uses the standard convention of the top line of the image being row #1. Totally standard. Not flipped. Everyone who deals with images does it this way.
Don't use pcolor for images. pcolor does something vastly different than imshow. You don't have the same number of "squares" for each pixel (it's one row short in each dimension) and the colors do not correspond to the image values but to the "tilt" of the square between the four corners (unless you use the flat shading option). Why would you want to use pcolor?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!