필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by