How to flip an axis on a plot without affecting the plot?
Mostrar comentarios más antiguos
I am trying to rotate the y axis of this plot such that the origin is at the upper left coner of the plot. How would I do so? 

This is the code I have to set up my plot.
% Plot averaged vector field
figure(3)
quiver(x(acceptIdx)/48.11,(y(acceptIdx)/48.11),u_avg(acceptIdx),v_avg(acceptIdx),4)
axis([0 42 0 42])
yticks([0 5 10 15 20 25 30 35 40])
set(gca,'XAxisLocation','top','YAxisLocation','left');
xlabel('z (mm)')
ylabel('x (mm)')
title('Dimensional velocity field')
I'd like the y axis to look identical to the x axis.
Thanks.
Respuesta aceptada
Más respuestas (1)
Ni2
el 16 de Oct. de 2019
Add this code
set(gca, 'YDir','reverse')
After the plot command
6 comentarios
Monique Embury
el 16 de Oct. de 2019
Editada: Monique Embury
el 16 de Oct. de 2019
Try this code
k = (min(y) + max(y))/2;
newy = 2*k - y;
plot(x,newy);
set(gca, 'YDir', 'reverse')
Here i have considered your x-axis variable is 'x' and initial y-axis variable is 'y'
Final y-axis variable is considered to be 'newy'
Monique Embury
el 16 de Oct. de 2019
Ni2
el 17 de Oct. de 2019
Can u send me your codes
Monique Embury
el 17 de Oct. de 2019
zhou weiyan
el 27 de Oct. de 2021
Thank you so much!
Categorías
Más información sobre Graphics Performance en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


