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