필터 지우기
필터 지우기

How can I reduce the distance between the axis and their title?

조회 수: 3 (최근 30일)
Mohammad
Mohammad 2014년 1월 21일
답변: dpb 2014년 1월 21일
my program is so that the user enters a figure,and the program should make it smaller. I'm almost done with the program,the only problem is that the distance between the axis and their title doesn't become smaller as the whole figure becomes smaller. How can I reduce the distance between the axis and their title?
this is my code:
h=hgload(name);
set(gcf,'paperunits','centimeters');
set(gcf,'paperposition',[w(1) w(2) a(1) a(1)*a(2)]);
textobj=findobj('type','text');
set(textobj,'fontunits','points');
set(textobj,'fontsize',w(3));
set(findall(gcf,'property','fontsize'),'fontsize',w(3));
set(gca,'fontsize',w(3));
set(findall(gca,'type','text'),'fontsize',w(3));
set(findall(gcf,'type','text'),'fontsize',w(3));
new_name=strrep([pathName name],'.fig','.png');
child=get(gcf,'children');
for y=1:length(child)
chi=child(y);
set(chi,'fontsize',w(3));
end

답변 (1개)

dpb
dpb 2014년 1월 21일
The position is set by the 'position' property and changing fontsize doesn't affect it (as you've noticed). You'll have to retrieve the various label position vectors and mung on them as needed to achieve the effect desired.
As an aside, it would likely be simpler if you were to save handles to the various objects as they're created and thus could access their properties directly thru the handle rather than all the "handle-diving" you're currently doing looking up stuff...

카테고리

Help CenterFile Exchange에서 Classification에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by