Reversing the y-axis values without reversing the image.

조회 수: 1 (최근 30일)
Syed Mashruk
Syed Mashruk 2020년 11월 22일
편집: Syed Mashruk 2020년 11월 22일
Hi,
I would like to flip the y-axis values without flipping the image. Your help is much appreciated.

답변 (3개)

Ameer Hamza
Ameer Hamza 2020년 11월 22일
An easy solution will be just flip the labels. Run the following line
yticklabels(flip(yticklabels))
after creating the figure.
  댓글 수: 1
Ameer Hamza
Ameer Hamza 2020년 11월 22일
Can you explain what do you mean by "Though it flips the Y-axis values but does not start from X-axis"? Can you draw on this image to show the expected output?

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2020년 11월 22일
After you display the image, try
axis xy
  댓글 수: 1
Image Analyst
Image Analyst 2020년 11월 22일
Did you try using YData in imshow():
yourImage = imread('peppers.png');
[rows, columns, numColorChannels] = size(yourImage);
imshow(yourImage, 'YData', [rows, 1]);
axis xy

댓글을 달려면 로그인하십시오.


Syed Mashruk
Syed Mashruk 2020년 11월 22일
Thanks both. I have solved the problem using 'fliplr' command.

Community Treasure Hunt

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

Start Hunting!

Translated by