How to bring a patch to the bottom of a figure?
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sim
el 6 de Mzo. de 2023
Comentada: Les Beckham
el 6 de Mzo. de 2023
How to bring a patch to the bottom of a figure?
[EDITED] In the following figure, I would like to have the two lines at the top, while the patch at the very bottom of the figure.
hold on
a = plot([1 2 3],[1 2 3],'color','k','LineWidth',3);
b = plot([4 3 2],1:3,'color','r','LineWidth',3);
c = fill([0 4 5 2 1],[0 0 2 4 3],'y');
hold off
3 comentarios
Respuesta aceptada
Voss
el 6 de Mzo. de 2023
Option 1: Call fill before plot:
figure()
hold on
c = fill([0 4 5 2 1],[0 0 2 4 3],'y');
a = plot([1 2 3],[1 2 3],'color','k','LineWidth',3);
b = plot([4 3 2],1:3,'color','r','LineWidth',3);
hold off
Option 2: Use uistack(_,'bottom'):
figure()
hold on
a = plot([1 2 3],[1 2 3],'color','k','LineWidth',3);
b = plot([4 3 2],1:3,'color','r','LineWidth',3);
c = fill([0 4 5 2 1],[0 0 2 4 3],'y');
hold off
uistack(c,'bottom')
2 comentarios
Más respuestas (1)
Les Beckham
el 6 de Mzo. de 2023
The code you originally posted already had the lines on top.
Just plot the lines after the patch.
hold on
c = fill([0 4 5 2 1],[0 0 2 4 3],'y');
a = plot([1 2 3],[1 2 3],'color','k','LineWidth',3);
b = plot([4 3 2],1:3,'color','r','LineWidth',3);
hold off
2 comentarios
Ver también
Categorías
Más información sobre Interactive Control and Callbacks 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!