Reversing x-axis direction for plotyy
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Kacper Witasinski
el 1 de Mayo de 2021
Respondida: Jan
el 1 de Mayo de 2021
Hello,
I am using set(gca,'XDir','Reverse') function for plotyy(x,y1,x,y2). However, the X-axis is reversed only for y1 function, values of y2 goes normally from 0....1 instead of 1...0. How to fix it?
0 comentarios
Respuesta aceptada
Jan
el 1 de Mayo de 2021
Use the two handles replied by plotyy:
t = linspace(0, 2*pi, 200);
hAx = plotyy(t, sin(t), t, cos(4*t));
pause(1)
set(hAx(1), 'XDir', 'reverse')
pause(1);
set(hAx(2), 'XDir', 'reverse')
gca is the current axes object only, while the 2 axes handles replied by plotyy let you access both.
By the way, plotyy is outdated. Use the modern yyaxis instead.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Two y-axis en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!