Prev: extracting points from smoothened curve in cftool into matlab workspace
Next: erreur de chargement de librairie .dll
From: Chris Rodgers on 26 May 2010 06:10 Does anyone know how to find the coordinates of the plotbox for a Matlab figure? It doesn't seem to be the 'position' or 'outerposition' property of the axis. There is a 'plotboxaspectratio' property, but not a 'plotboxposition'? The following code shows what I mean. I would like to put the button on the edge of the "image" that has been drawn. % Find where the edge of the axis box ("plotbox") lies... figure clf img = randn(128,96); pixelSpacing = [1 1.5]; [rowdata,coldata]=ndgrid([-0.5:(size(img,1)-0.5)]*pixelSpacing(1),[-0.5:(size(img,2)-0.5)]*pixelSpacing(2)); hTmp = surf(rowdata,coldata,zeros(size(coldata)),double(img)); view(2) shading flat set(gca,'DataAspectRatio',[1 1 1]) axis tight %% How can we position this button in the top-right corner of the surface %% that has just been drawn? hButton = uicontrol(gcf,'style','pushbutton') Many thanks, Chris.
From: us on 26 May 2010 07:09 Chris Rodgers > %% How can we position this button in the top-right corner of the surface > %% that has just been drawn? > hButton = uicontrol(gcf,'style','pushbutton') one of the solutions uh=uicontrol(gcf,... 'position',[50,50,40,40],... % <- play with this and other parameters... 'style','pushbutton'); us
From: Kelly Kearney on 26 May 2010 10:18
Chris Rodgers <see-rodgers-org-uk-for-contact-details(a)invalid.gg> wrote in message <htis2j$1e0$1(a)news.ox.ac.uk>... > Does anyone know how to find the coordinates of the plotbox for a Matlab > figure? > > It doesn't seem to be the 'position' or 'outerposition' property of the > axis. There is a 'plotboxaspectratio' property, but not a 'plotboxposition'? Basically, you need to look at the combination of the position along with all the aspect ratios. This function calculates it for you: http://www.mathworks.com/matlabcentral/fileexchange/9615-plotboxpos I've actually been meaning to update that function so it doesn't require the non-standard getInUnits function. I'll upload an updated version later today. -Kelly |