How to set the default corner for origo in imagesc?

24 views (last 30 days)
I would like to use origo in the bottom-left corner as mathematicians used to.

Answers (2)

Geoff Hayes
Geoff Hayes on 14 Nov 2014
Merse - do you just want to reverse the order of the y-axis so that zero (along y) is in the bottom left corner? Or do you want to be able to manipulate the data in the image given that new ordering? If just the former, then you could do
% get the handle to the image
hImg = imagesc(...);
% get the handle to the parent axes
hAxs = get(hImg,'Parent');
% reverse the order of the y-axis tick labels
yAxisTickLabels = get(hAxs, 'YTickLabel');
set(hAxs,'YTickLabel',flipud(yAxisTickLabels));
The above code just flips the y-axis tick labels so that their order is reversed. NOTE that this does not change the manner in which you can access the data in the image, all it does is flip the labels.

Image Analyst
Image Analyst on 9 Jun 2022
By default, images use
axis ij
which puts the (1,1) location at the upper left as is the convention for arrays and images. If you want it at the lower left, like an (x,y) plot use
axis xy;

Categories

Find more on Graphics Object Properties in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!