using errorbar I get the error bars' caps on top of (in front) of the symbol

4 次查看(过去 30 天)
I am using the errorbar function that is able to show both error bars on X and Y. when the errors are smaller than the symbol I expect the error bar would not show (hidden behind the symbol), but instead the error bar caps show ON TOP of the symbol. I overcome this by using the plot function after errorbar, but that is surely not the elegant way.
Am I missing something? or is that a bug?
here's a code to generate the same phenomenon:
% generate data
x=1:10;
y(:,1)=2*x+rand(1,10);
ex(:,1)=rand(1,10);
ey(:,1)=rand(1,10);
y(:,2)=2*x+rand(1,10)+5;
ex(:,2)=rand(1,10)*2;
ey(:,2)=rand(1,10)*2;
% plot
for i=1:2
errorbar(x',y(:,i),ex(:,i),ex(:,i),ey(:,i),ey(:,i),...
'sk','MarkerFaceColor','r',...
'MarkerSize',20,...
'LineWidth',2);
hold on
end
  2 个评论
dpb
dpb 2017-7-19
I would presume the code was written with the assumption by the author that if one were using errorbar that the prime impetus would be to see the error ranges; hence I'm not at all surprised it places them in the foreground plane rather than occluded by the marker symbol. After all, when they're smaller, all that is known is that they're not big-enough to show up but that could be anywhere from that size to essentially (or even identically) zero. In short, seems to me a reasonable expectation for most users.
Given the above rationale, if that's not what's wanted in a particular instance I'd say your workaround is the likely solution...
I'll add the usual caveats $0.02, imo, ymmv, etc., etc., etc., ... on this one.
the cyclist
the cyclist 2017-7-19
编辑:the cyclist 2017-7-19
Imagine the scenario where the very small error bars simply do not display by default. I would expect most people would be very confused by the "bug" that their error bars aren't being plotted. :-)
I think the current default behavior makes a lot of sense.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Errorbars 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by