Adjust width of error bars

조회 수: 3 (최근 30일)
Bernoulli Lizard
Bernoulli Lizard 2012년 10월 16일
How can I adjust the width of the error bars on a plot that I have already made? I found a few downloadable functions that claim to solve this problem, but I can not use them for plots (.fig files) that I have already made. Since I can't re make all of my plots (that would take days) is there any way that I can change the error bar width at this point?
thanks
  댓글 수: 2
Matt Fig
Matt Fig 2012년 10월 16일
What do you mean by the widths? Do you mean the spread of the error bars (effectively changing the error), or the linewidths of the lines that make the bars? Please try to be more specific in your descriptions.
Bernoulli Lizard
Bernoulli Lizard 2012년 10월 16일
None of the above. I want to change the horizontal length of the bars. I can change the line width (which is like the 'font size' of the line) under figure properties.

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

답변 (1개)

Matt Fig
Matt Fig 2012년 10월 16일
편집: Matt Fig 2012년 10월 16일
O.k., here is an example:
X = 0:pi/10:pi;
Y = sin(X);
E = std(Y)*ones(size(X));
B = errorbar(X,Y,E) ;
pause(1)
C = get(B,'children');
X = get(C(2),'xdata');
X2 = reshape(X,9,[]);
X2([4 7],:) = X2([4 7],:)-.2;
X2([5 8],:) = X2([5 8],:)+.2;
set(C(2),'xdata',X2(:).')
So for your problem just use FINDALL to get the handle to the errorbar hggroup then run the code I show on that handle. You could even set it up to open each figure one by one and do it by using DIR or WHAT.
  댓글 수: 2
Bernoulli Lizard
Bernoulli Lizard 2012년 10월 16일
I don't understand. How am I supposed to use FINDALL to get the handle from a .fig file?
Matt Fig
Matt Fig 2012년 10월 16일
편집: Matt Fig 2012년 10월 16일
O.k., perhaps a more extensive example will help (did you read the help for FINDALL??):
F = figure;
X = 0:pi/10:pi;
Y = sin(X);
E = std(Y)*ones(size(X));
errorbar(X,Y,E) ;
hgsave(F,'error_bar_examp') % Save the figure
close(F) % close the figure
% Now we will open the figure and proceed:
F = hgload('error_bar_examp');
B = findall(F,'type','hggroup'); % Get the handle.
% Now we are back to where we were before the pause
% in my previous example... Proceed the same way from here.
Also, for your reference you may want to read:
doc findall
doc errorbar
doc dir

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

카테고리

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