Display of errorbar function in plot legend
6 次查看(过去 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!