How do I reverse the y-axis in image?
264 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
The image function reverses the y-axis so I wanted to reverse it to correct it. I know it has something to do with gca but cannot figure out the right code. Please help me.
0 Commenti
Risposta accettata
Orion
il 25 Nov 2014
Modificato: MathWorks Support Team
il 27 Nov 2018
You can change the direction of increasing values along the y-axis by setting the YDir property of the Axes object.
If you want the values to increase from bottom to top (2-D view), then set the value to 'normal'. Alternatively, if you want the values to decrease from bottom to top, then set the value to 'reverse'. For example:
ax = gca;
ax.YDir = 'normal'
2 Commenti
Più risposte (4)
Shane
il 25 Nov 2014
Alternatively, you can flip the array. Either fliplr or flipud Flip Left-Right, or Up-Down, depending on how your data is.
plot(X, fliplr(Y))
0 Commenti
Jamel
il 7 Giu 2022
How do I reverse the "Interference from Satellite Constellation Communication Link" code, where the direction starts from the opposite way.
0 Commenti
Vedere anche
Categorie
Scopri di più su Graphics Object Programming in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!