Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Text property, 'extent', not working properly
Date: Sun, 19 Jul 2009 13:07:02 +0000 (UTC)
Organization: Univeristy of Michigan
Lines: 56
Message-ID: <h3v5pm$6sa$1@fred.mathworks.com>
References: <h3slb9$nsa$1@fred.mathworks.com> <h3t9g9$fe2$1@fred.mathworks.com> <h3tt69$e99$1@fred.mathworks.com> <h3u041$lov$1@fred.mathworks.com> <h3v2ih$6h1$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1248008822 7050 172.30.248.38 (19 Jul 2009 13:07:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 19 Jul 2009 13:07:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1397212
Xref: news.mathworks.com comp.soft-sys.matlab:556595


"us " <us@neurol.unizh.ch> wrote in message <h3v2ih$6h1$1@fred.mathworks.com>...
> % the look at the definition of EXTENT...
> % in general, yet depending on the UNITs',
> % the EXTENT is NOT equal to the POSITON

Yes, I understand this.  The extent is rarely equal to the position.  

I may have done a poor job of explaining my issue.  My claim is that the spacing between the text extent boxes should be the same as the grid spacing (cs).

I've changed my code to try to emphasize this:
_______________________________________________________________________
figure;
f=[450,450];
set(gcf,'Units','points','position',[0,0,f(1),f(2)])
fig_ax=axes('Units','points','Position',[0 0 f(1) f(2)],...
    'xlim',[0,f(1)],'ylim',[0,f(2)],'Visible','off'); %<-Setting axis limits your way
axis([0 f(1) 0 f(2)]); %<-This also sets the axis limits

grid_spacing=24;
for i=1:2
    for j=1:2
        label=text(j*grid_spacing,450-i*grid_spacing,'f','FontSize',18,...
            'HorizontalAlignment','center','Interpreter','tex',...
            'VerticalAlignment','bottom','FontName','Helvetica','units','points');
        label_ext=get(label,'extent');
        x_ext(i,j)=label_ext(1);
        y_ext(i,j)=label_ext(2);
    end
end
dx=x_ext(:,2)-x_ext(:,1)
dy=y_ext(1,:)-y_ext(2,:)
_______________________________________________________________________

When grid_spacing=24, the output is:

dx =
   24.0000
   24.0000

dy =
    24    24

This is correct.  The grid spacing matches the spacing between the text extent boxes.

However, when grid_spacing=25, the output is:

dx =
   25.6000
   25.6000

dy =
   24.8000   24.8000

This, in my view, is incorrect.  The grid spacing does not match the spacing between the text extent boxes.

Well, hopefully I've been a little more clear now.