フィルターのクリア

Automatic Axes Resize behavior

1 回表示 (過去 30 日間)
Af
Af 2012 年 7 月 16 日
Hi
Just a simple question, it seems that for 3D figures the position and outerposition of the axes do not quite match with what is explained in the following documnetation link: http://www.mathworks.se/help/techdoc/creating_plots/f1-32495.html
As I ran a very simple code to get the extent of the axes:
function DmnstrBrdrFg
plot3(1:5,1:5,1:5)
set(gca,'XTickLabel',[],'YTickLabel',[],'ZTickLabel',[])
Ps= get(gca,'Position');
OPs= get(gca,'OuterPosition');
PltBrdr(Ps,'P')
PltBrdr(OPs,'O')
function PltBrdr(Ps,Chr)
FndDtPnts(Ps(1),Ps(2),Chr,1);
FndDtPnts(Ps(1)+Ps(3),Ps(2),Chr,2);
FndDtPnts(Ps(1)+Ps(3),Ps(2)+Ps(4),Chr,3);
FndDtPnts(Ps(1),Ps(2)+Ps(4),Chr,4);
function Out=FndDtPnts(Ps1,Ps2,Chr,Id)
text(Ps1,Ps2,[Chr '_'num2str(Id)],'Unit','normalized','Visible','on');
As it seems the corners of OuterPosition point at where it is supposed to be the corners of Position and I don't know what are the corners where Position point at.
Any idea?
Best regards Afshin

採用された回答

Sean de Wolski
Sean de Wolski 2012 年 7 月 16 日
The normalized region for the text is at the outer border of the position. To get it further out, you have to work outside the range of [0 1]. Consider somehting liek this:
function DmnstrBrdrFg
plot3(1:5,1:5,1:5)
set(gca,'XTickLabel',[],'YTickLabel',[],'ZTickLabel',[])
Ps= get(gca,'Position');
OPs= get(gca,'OuterPosition');
set(gcf,'activepositionproperty','outerposition');
PltBrdr(Ps,'P')
PltBrdr2(OPs,'O')
function PltBrdr(Ps,Chr)
FndDtPnts(Ps(1),Ps(2),Chr,1);
FndDtPnts(Ps(1)+Ps(3),Ps(2),Chr,2);
FndDtPnts(Ps(1)+Ps(3),Ps(2)+Ps(4),Chr,3);
FndDtPnts(Ps(1),Ps(2)+Ps(4),Chr,4);
function Out=FndDtPnts(Ps1,Ps2,Chr,Id)
text(Ps1,Ps2,[Chr '_' num2str(Id)],'Unit','normalized','Visible','on');
function PltBrdr2(Ps,Chr)
FndDtPnts(Ps(1)-.1,Ps(2)-.1,Chr,1);
FndDtPnts(Ps(1)+Ps(3)+.1,Ps(2)-.1,Chr,2);
FndDtPnts(Ps(1)+Ps(3)+.1,Ps(2)+Ps(4)+.1,Chr,3);
FndDtPnts(Ps(1)-.1,Ps(2)+Ps(4)+.1,Chr,4);
function Out=FndDtPnts2(Ps1,Ps2,Chr,Id)
text(Ps1,Ps2,[Chr '_' num2str(Id)],'Unit','normalized','Visible','on');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by