Copying (copyobj) boxplot from anova1 to new subplot
2 views (last 30 days)
Show older comments
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');
0 Comments
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!