2014-10-29 1 views
1

나는 몇몇 축이있는 Gui가있다. 이제 새 축에 하나의 축을 배치합니다. 다음은 내 코드입니다 :이 작품그림을 그리는 Matlab GUI 축

h = handles.axes3; % Find the axes object in the GUI 
f1 = figure % Open a new figure with handle f1 
s = copyobj(h,f1); % Copy axes object h into figure f1 
print(f1,'-dpsc', 'raspberry.eps'); 

, 그러나 창은 그림과 같은 크기를하지 않았습니다. GUI의 축이 새로운 그림의 축 1에 있지 않다고 생각합니까?

답변

1

그림이 아닌 축을 복사했습니다.

새 그림을 만들면 기본 크기 인 것이 생성됩니다.이 크기는 일반적으로 handles.axes3의 조상 (그림)과 같은 크기가 아닙니다.

아래의 예를 참조하십시오 :

f = figure ('position', [100 100 200 200]); 
h = axes ('position', [0 0 0.5 0.5], 'parent', f); 

% This will create a figure with a different size 
f1 = figure ('Name', 'Different Size Fig'); 
copyobj (h, f1); 

% copy a figure which has the same size as the original 
hFig = ancestor (h, 'figure'); 
originalFigPos = get (hFig, 'position'); 
f2 = figure ('Name', 'Same Size Fig'); 
newFigPos = get (f2, 'position'); 
newFigPos(3:4) = originalFigPos(3:4); 
set (f2, 'position', newFigPos); 

s = copyobj (h, f2);