필터 지우기
필터 지우기

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 CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by