using errorbar I get the error bars' caps on top of (in front) of the symbol
조회 수: 5 (최근 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
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
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 Center 및 File Exchange에서 Errorbars에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!