Filter löschen
Filter löschen

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

3 Ansichten (letzte 30 Tage)
Mohammad
Mohammad am 21 Jan. 2014
Beantwortet: dpb am 21 Jan. 2014
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

Antworten (1)

dpb
dpb am 21 Jan. 2014
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...

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by