Borrar filtros
Borrar filtros

Automatic Axes Resize behavior

1 visualización (últimos 30 días)
Af
Af el 16 de Jul. de 2012
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

Respuesta aceptada

Sean de Wolski
Sean de Wolski el 16 de Jul. de 2012
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');

Más respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by