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 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Image Analyst
am 29 Mai 2012
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.
Akzeptierte Antwort
Image Analyst
am 29 Mai 2012
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?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices 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!