raacampbell / shadedErrorBar

Produce elegant shaded error bars in MATLAB
GNU Lesser General Public License v3.0
174 stars 70 forks source link

Can not draw the results to UIFigure. #23

Closed christzhang2022 closed 1 year ago

christzhang2022 commented 1 year ago

I want to draw the figure with shaded error bars in an existing axis area in a "UIFigure“. But it always draw the figure by opening a new figure. However, it won't open a new figure when I designate an axis in a “”Figure”. In other words, the function works fine with "Figure", but not with ”UIFigure”. Could anyone fix it?

raacampbell commented 1 year ago

Done - 80c07a5d29ce957f3d65a8f402bbb34a98518611 See new example. You have to specify the axis.

christzhang2022 commented 1 year ago

Hi, thank you for your brilliant work and prompt response. The revised function works well. It will plot in the specified axis area. But I don't know why it always pop up an empty figure when I draw the plot in a "uifigure". My codes are as follows:

data = [1 0.30 0.22 2 0.40 0.19 3 0.52 0.11 4 0.61 0.15 5 0.39 0.50 6 0.30 0.19 7 0.20 0.22 8 0.09 0.10 9 0.07 0.11 10 0.05 0.18 11 0.05 0.21];

x = data(:,1); y= data(:,2); ysd = data(:,3); yErrBar = [ysd ysd];

fig = uifigure;
fig.AutoResizeChildren = 'off'; h0 = subplot(2,1,1,'parent', fig); h = shadedErrorBar(x, y, yErrBar, 'plotAxes', h0);