Display of errorbar function in plot legend
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi
I am annoyed about a line going through the errorbar symbol in my legend. I have tried to make a dummy plot for handles, ploting it prior to all other plots with lines in them, but it does not change anything. I can not find any information about it in the documentation and I was not able to find any other treads where this was complained about and obviously not any solution either. I attached an image below since it is a bit hard to explain. Thanks a lot!
This is how I ploted the errorbar
errorbar(mean(x1),mean(y1),sdy1,sdy1,sdx1,sdx1,'k')
댓글 수: 0
답변 (1개)
Mann Baidi
2024년 6월 14일
I can understand that you would like to remove the line in the errorbar legend symbol.
Although I am not aware the proper solution, I have a possible workaround which might be helpful:
You can remove the 'k' parameter from the errorbar function, and set the 'LineStyle' parameter to 'None'. This will avoid plotting the line in the graph. However, if you still want to plot the line, you can use 'hold on' command in matlab and plot the line separately.
You can check to the following code for reference:
x = 1:10:100;
y = [20 30 45 40 60 65 80 75 95 90];
yneg = [1 3 5 3 5 3 6 4 3 3];
ypos = [2 5 3 5 2 5 2 2 5 5];
xneg = [1 3 5 3 5 3 6 4 3 3];
xpos = [2 5 3 5 2 5 2 2 5 5];
errorbar(x,y,yneg,ypos,xneg,xpos,'LineStyle','none')
hold on
plot(x,y)
legend({'Line_1'})
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Errorbars에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!