MATLAB: Legend error. What did I do wrong here

legendplot

I have 9 figures as per attached to make comparisons for the length, width and height using similar codes as below (this one was used for the width comparison).
I don't know why the legend for the plots of length and height comparions are correct but it is wrong for the width comparison. How to fix please?
if true
fig = figure(16);
ax = axes(fig);
xlabel('\xi');
ylabel(' \omega(\xi,\tau)');
title('Varying injection rates vs fracture width');
h1 = openfig('width0.fig','reuse');
h2 = openfig('width1.fig','reuse');
h3 = openfig('width2.fig','reuse');
copyobj(h1.Children.Children,ax);
copyobj(h2.Children.Children,ax);
copyobj(h3.Children.Children,ax);
close(h1);
close(h2);
close(h3);
end
hold on
legend('\alpha=0','\alpha=1/9','\alpha=1/10','location', 'northeast')

Best Answer

The "width" figures contain multiple lines on top of each other just like in your last question.
To demonstrate, open the width0.fig and look at the number of objects on the axes.
h = openfig('width0.fig');
h.Children.Children
% 2×1 Line array:
%
% Line

% Line
You'll see two line objects. If you only want to copy one of them,
copyobj(h.Children.Children(1),ax);
% ^^^