MATLAB Answers

Set y axis of image in imshow at the bottom without flipping the image

11 views (last 30 days)
Alfonso
Alfonso on 16 Jun 2018
At the moment when I display the image with imshow the y axis are logically set with the origin at the top. I would like to know if there is a way of setting the origin at the bottom but without flipping the image. If I use
set(gca,'YDir','normal');
The origin is at the bottom but the image is flipped.
I am using ecography images, so I can't use imagesc.
Thanks in advance.

  0 Comments

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 16 Jun 2018
I don't understand what you want. Do you have tick labels but want the tick labels flipped but the image not flipped? If so use yticklabels()
grayImage = imread('cameraman.tif');
imshow(grayImage);
axis on;
[rows, columns, numberOfColorChannels] = size(grayImage)
yTickNumbers = rows - yticks
for k = 1 : length(yTickNumbers)
ytl{k} = sprintf('%3d', yTickNumbers(k));
end
yticklabels(ytl)

  3 Comments

Alfonso
Alfonso on 16 Jun 2018
Yes, I want the image like that. But changing the Y tick labels only changes the labels or does it change the labels and the y values? I mean, in your image looking at the axis labels the point (50,56) (right leg) and I get this point with ginput, would the plotted point, in cartesian coordinates logically, be (50,56)?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!