Changing layers on a bar graph

11 Ansichten (letzte 30 Tage)
Jiaqi Wang
Jiaqi Wang am 1 Aug. 2022
Kommentiert: Jiaqi Wang am 4 Aug. 2022
I am making a plot like this:
I want to move the green rectangles behind the two bars. Is there any ways to achieve that other than simply chanign the transparency?
Thanks for everyone who answers my question!

Akzeptierte Antwort

Adam Danz
Adam Danz am 1 Aug. 2022
Bearbeitet: Adam Danz am 1 Aug. 2022
Plot the green bars first, before the bar plot.
Alternatively use uistack to control the stacking order of graphics objects.
  5 Kommentare
Adam Danz
Adam Danz am 2 Aug. 2022
Bearbeitet: Adam Danz am 4 Aug. 2022
Demo:
figure
bar(1:3)
hold on
h = plot([0,4],[.5 .5],'k-','LineWidth', 5);
figure
bar(1:3)
hold on
h = plot([0,4],[.5 .5],'k-','LineWidth', 5);
uistack(h,'bottom')
Jiaqi Wang
Jiaqi Wang am 4 Aug. 2022
This works perfectly! Thank you so much!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Specifying Target for Graphics Output finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by