# How to bring a patch to the bottom of a figure?

6 views (last 30 days)
Sim on 6 Mar 2023
Commented: Les Beckham on 6 Mar 2023
How to bring a patch to the bottom of a figure?
(Maybe with uistack?)
[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
Sim on 6 Mar 2023
oh gosh, it was very simple... sorry for this silly question..
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')

Voss on 6 Mar 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 CommentsShow 1 older commentHide 1 older comment
Voss on 6 Mar 2023
You're welcome!

Les Beckham on 6 Mar 2023
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 CommentsShow 1 older commentHide 1 older comment
Les Beckham on 6 Mar 2023
You are quite welcome.

### Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by