MATLAB Answers

How to switch the position and values of X and Y axes?

5 views (last 30 days)
Hi
I need to switch the position and values of X and Y axes in plotting colormaps. I am using "imagesc" to plot the graphs and eventually, the values for X and Y axes apprear incorrectly. Any help would be appreciated.

  0 Comments

Sign in to comment.

Accepted Answer

Adam Danz
Adam Danz on 19 Oct 2020
Edited: Adam Danz on 19 Oct 2020
"I need to switch the position and values of X and Y axes in plotting colormaps"
Do you mean instead of imagesc(x,y,c) you want imagesc(y,x,C)?
Or do you want to flip any of the axes using ax=gca; ax.YDir='reverse'or ax.XDir='reverse';?
Or do you want to change which side of the axes host the ticks and labels using ax.XAxisLocation='top'; ax.YAxisLocation='right'?

  3 Comments

arash ahmadivand
arash ahmadivand on 19 Oct 2020
Hi Adam,
Thanks for your reply. Indeed, my question is automatically responded by your first question. I just replaced the imagesc(z,y,F(y)) with imagesc(y,z,F(y)), and the problem is solved. Thanks so much.
Adam Danz
Adam Danz on 19 Oct 2020
Glad I could help.
Your question was clear but I wanted to cover other interpretations just in case.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!