Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

How to flip axis on an image?

1 visualizzazione (ultimi 30 giorni)
Richard Mcnair
Richard Mcnair il 26 Set 2021
Chiuso: Richard Mcnair il 26 Set 2021
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 Commento
Richard Mcnair
Richard Mcnair il 26 Set 2021
I've just done it. It can be done in a single line of code:
view([0,-90])

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by