필터 지우기
필터 지우기

How does I bring the line plot in front of the bar?

조회 수: 199 (최근 30일)
Kwanghun Choi
Kwanghun Choi 2019년 2월 25일
편집: Adam Danz 2021년 12월 5일
I am makeing the graph to illustrate some information with plot function and bar function.
Problem is the line made by plot function is always back of the bar, so some part of line is hided like a image below.
It is possible to control the size of axis to make not to be overlaped, but I do not want to do that.
How can I bring the line in front of the bar?

채택된 답변

Kevin Phung
Kevin Phung 2019년 2월 25일
Use uistack();
a = plot(x,y) %let a be the handle to plot 1
b= plot(x2,y2) %let b be the handle to plot 2
uistack(a,'top') %you can also do uistack(b,'bottom')
  댓글 수: 1
Adam Danz
Adam Danz 2021년 12월 5일
편집: Adam Danz 2021년 12월 5일
As of Matlab R2021b, uistack does not work with yyaxis since the objects are assigned to different rulers.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jakub Schneider
Jakub Schneider 2020년 11월 25일
When using multiple y axis plot (yyaxis left and yyaxis right) the yyaxis right plot is on the top. So just switch left to right and the line will be over the bars.
  댓글 수: 1
Jakob Weis
Jakob Weis 2021년 6월 8일
When using two y-axes, simply switching the data/axes is rarely an option. The primary dataset has to go on the primary/left axis and the secondary dataset on the secondary right/axis.
Here's a workaround for this case: https://www.mathworks.com/matlabcentral/answers/280015-draw-stack-order-for-yyaxis

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by