Duplicate a Catergorical Barchart on an axes component to a new figure - Xticklabels are messing up

1 visualización (últimos 30 días)
Hello.
I have a GUIDE Gui with several axes components on. One of these (Axes(handles.axes2) has a barchart on with a Catergorical X-axis.
I am trying to copy this to a new figure, but can't quite get th catergorical x-axis labels correct.
%Extract Everything from my main Guide GUI from the axes2 component
axes(handles.axes2)
hh1 = findobj(gca,'Type','bar')
hh2 = findobj(gca,'Type','text')
hh3 = findobj(gca,'Type','Legend')
tl=xticklabels(gca)
%Create a new figure
figure
%Copy to the figure (subplot)
hSub2 = subplot(1,2,2); grid on; grid minor;
if ~isempty(hh1)
copyobj(hh1,hSub2);
copyobj(hh2,hSub2);
copyobj(hh3,hSub2);
end
%Add the x-axis ticklabels
xticklabels(gca,tl)
drawnow;
But as you can see, Im not quite able to duplicate my original barchart on axes2 (left) to that on the new figure (right). Also the colors and legend appearance are not the same.
matlab139.png
Does anyone have any advice please?
Thanks
Jason

Respuestas (0)

Categorías

Más información sobre Modify Image Colors en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by