nikosdi
nikosdi

Reputation: 2158

Matlab pcolor() function and mirror output

I am trying to plot an image of a matrix using the pcolor(). The matrix presents a field. (In my case a sea field! But it does not matter:) ). The problem is that when I plot the matrix using pcolor() the matrix is ploted mirrored.

An example:

A=[1 0 0;0 1 0;0 0 1];

If I plot the matrix, the cell (0,0) will be plotted not in the top left corner but in the bottom left corner.(Its obvious the start of the axes is (0,0) I understand that the function is working properly!) I know also the existence of the flipdim() functions to flip the matrix. The problem is that the code becomes ugly if I use this approach.For example the cell(0,0) in the matrix will be appeared in cell(size(A,1),0) and everything becomes opposite! How can I face that problem in a more elegant way? (The matrix to be printed as a terian for example and not mirrored)

Edit:

Solved using axis ij

Upvotes: 0

Views: 2487

Answers (1)

yuk
yuk

Reputation: 19870

In general, to change the direction of axis you can set YDir (or XDir) property from normal to reverse.

set(gca,'YDir','rev')

PCOLOR function produce axis with YDir set to normal. In opposite, IMAGESC's YDir is reverse by default.

Upvotes: 1

Related Questions