Copying (copyobj) boxplot from anova1 to new subplot

24 次查看(过去 30 天)
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');

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 ANOVA 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by