Removing lower marker in error plot

조회 수: 2 (최근 30일)
Sowmya MR
Sowmya MR 2016년 12월 28일
편집: the cyclist 2016년 12월 28일
Hi,
I am trying to plot one sided error plot. Here is the sample code and output. I want to remove the markers circled in red. Can someone please help me with this?
x = 1:10;
X1=rand(13,10);
y = mean(X1);
U= std(X1);
L=zeros(size(y));
errorbar(x,y,L,U,'--k','LineWidth',2)

답변 (3개)

the cyclist
the cyclist 2016년 12월 28일
errorbar(x,y,[],U,'--k','LineWidth',2)
  댓글 수: 2
Sowmya MR
Sowmya MR 2016년 12월 28일
Thank you. But it gives me an error... "X, Y, and error bars all must be the same length."
the cyclist
the cyclist 2016년 12월 28일
I'm guessing that you have an older version of MATLAB that does not support this syntax. I've posted another solution that might work.

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


the cyclist
the cyclist 2016년 12월 28일
errorbar(x,y,nan(size(x)),U,'--k','LineWidth',2)
  댓글 수: 1
Sowmya MR
Sowmya MR 2016년 12월 28일
Thank you, i did try nan but it removes the lines as well. (The curve remains but the line connecting the upper markaer and the curve disappears)

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


the cyclist
the cyclist 2016년 12월 28일
편집: the cyclist 2016년 12월 28일
This solution will not work on newer versions of MATLAB, but I wonder if making the lower error bar in the "wrong" direction will make it overlap the upper one.
I'm not sure which sign makes sense, so try either
errorbar(x,y,U,U,'--k','LineWidth',2)
or
errorbar(x,y,-U,U,'--k','LineWidth',2)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by