MATLAB: Copying (copyobj) boxplot from anova1 to new subplot

anovaanova1axesboxplotcopycopyobjgroupsubplot

Hi all.
I am using the anova1 function to produce a set of boxplots, which I then want to copy to a subplot alongside another figure.
When I do that using the code below, the boxes themselves scale perfectly fine, but it groups the boxes with the axis from the original figure and neglects to scale them, meaning in the subplot there are two axis set, one linked to the boxes but scaled wrong, and one on the subplot that work fine (see bottom plot in image). Any ideas on how to fix this?
Code:
stats = anova1(lam);
% Prepare ANOVA boxplot for copying
f = gcf;
axis off
hgsave(f,'two.fig')
close(f)
% Create figure
figure;
a1 = subplot(2,1,1);
First subplot code
a2 = subplot(2,1,2);
f_c = openfig('two.fig');
%Copy boxplot
hg1 = get(gca,'Children');
ch = get(hg1,'Children');
set(a2,'Xlim',[0,11])
copyobj(ch,a2)
close(f_c);
delete('two.fig');

Best Answer

Solved by putting
set(gca,'xticklabel',{''})
after the openfig command. For some reason removing the labels using set(gca,'xticklabel',[]) wouldn't work