0
votes

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

1
Not too sure if I fully follow your problem correctly. But if I do, pcolor does plot matrices in an uncommon way IMO. Does pcolor(A.') fix your issue?Geodesic
if I plot pcolor(eye(5)); I receive the opposite image((Mirrored). Am I right on that ? I want to have 1 on the top left and not 1 on the bottom left of the plotnikosdi
I think I fixed it using axis ij. Thanks for the help!Goodnight!nikosdi
@nikosdi: You should make you last comment as your own answer.yuk

1 Answers

1
votes

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.