MATLAB: How to plot a picture in squared sized using imagesc

imagesc

Hi there, i'm using imagesc to plot a colormap, in which the x/y data are equal in size, but when I plot it using imagesc, the output picture is always a rectangle rather than a square, I wonder how can I solve this problem,many thanks a lot!

Best Answer

Try different axes options until you get what you like, like
axis square;
axis equal;
axis image;