Barweb in 2014b doesn't work any more
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Rainer
am 16 Okt. 2014
Kommentiert: Oleg Komarov
am 3 Jan. 2015
One of my favorite community functions barweb not longer works with 2014b due to the change in the way figure handles are referenced. Are there any barweb users out there that managed to tweak the barweb.m file to make it work?
1 Kommentar
Akzeptierte Antwort
Robert Cumming
am 17 Okt. 2014
The problem with this function is that it is failing on getting the X position of each bar - so that the errorbar can be placed on the middle of the bar.
The error actually occurs on:
x=get(get(handles.bars(i),'children'), 'xdata');
In HG1 this line was getting the X position of the patch. The bar is no longer a patch so you need to get the x position another way.
If you update the if statement to the following:
% Plot erros
for i = 1:numbars
if ~verLessThan('matlab', '8.4') % HG2
x = handles.bars(i).XData + handles.bars(i).XOffset;
else
x =get(get(handles.bars(i),'children'), 'xdata');
x = mean(x([1 3],:));
end
handles.errors(i) = errorbar(x, barvalues(:,i), errors(:,i), 'k', 'linestyle', 'none', 'linewidth', 2);
ymax = max([ymax; barvalues(:,i)+errors(:,i)]);
end
It works for a "trivial" example. I didn't check for passing in anymore than 2 inputs.
3 Kommentare
Robert Cumming
am 17 Okt. 2014
XOffset is a hidden property which details the position of the bar relative to the XData.
Weitere Antworten (1)
Sean de Wolski
am 16 Okt. 2014
It looks like there are a few things in the legend call that need to change. The legend is no longer an axes so that is no longer a valid check.
Siehe auch
Kategorien
Mehr zu Errorbars finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!