Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to flip axis on an image?

조회 수: 1 (최근 30일)
Richard Mcnair
Richard Mcnair 2021년 9월 26일
마감: Richard Mcnair 2021년 9월 26일
So, I have an image with an axis, but the axis is flipped compared to how I want it. The axis variables are t, and if I first say t = flip(t), I now get the correct image with the axis correct, but it is now upside down.
I have looked at other Matlab questions, for example
But the solutions presented dont solve my problem. The best solution I have found so far is the following code
yLimits = get(gca,'YLim'); %# Get the y axis limits
yTicks = t(end)+t(1)-get(gca,'YTick'); %# Get the y axis tick values and
%# subtract them from the upper limit
set(gca,'YTickLabel',num2str(yTicks.')); %'# Convert the tick values to strings
%# and update the y axis labels
This works, the axis is correct, and the image is the correct way up, but the choice of ticks is now wierd. Instead of having ticks at 0, 0.1, 0.2, etc, I have ticks at 0.11334 and other strange values. I have really tried everything with this. Why does doing t = flip(t) also flip the image?
  댓글 수: 1
Richard Mcnair
Richard Mcnair 2021년 9월 26일
I've just done it. It can be done in a single line of code:
view([0,-90])

답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by