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 14:52:01 +0000 (UTC)
Organization: Univeristy of Michigan
Lines: 45
Message-ID: <h3vbuh$jle$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> <h3v5pm$6sa$1@fred.mathworks.com> <h3v8t2$rl$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1248015121 20142 172.30.248.35 (19 Jul 2009 14:52:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 19 Jul 2009 14:52:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1397212
Xref: news.mathworks.com comp.soft-sys.matlab:556610


Ok, I modified my code to include your suggestions:
________________________________________________________________________
figure;
f=[450,250];
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');
axis([0 f(1) 0 f(2)]);

grid_spacing=25;
for i=1:2
    for j=1:2
        label=text(j*grid_spacing,f(2)-i*grid_spacing,'\delta','FontSize',18,...
            'HorizontalAlignment','center','Interpreter','tex',...
            'VerticalAlignment','bottom','FontName','Helvetica','units','points');
        label_ext=get(label,'extent');
        label_pos=get(label,'position');
        x_ext(i,j)=label_ext(1);
        x_pos(i,j)=label_pos(1);
        y_ext(i,j)=label_ext(2);
        y_pos(i,j)=label_pos(2);
        line([x_pos(i,j),x_pos(i,j)],[0,f(2)],...
          'color',[1,0,0]);
        line([x_ext(i,j),x_ext(i,j)],[0,f(2)],...
          'color',[0,1,0]);
    end
end
dx=x_ext(:,2)-x_ext(:,1)
dy=y_ext(1,:)-y_ext(2,:)
_______________________________________________________________________

1) The lines do show me that position and extent are not the same, but I was not disputing this.  The red lines are in the center of the text, and they are correctly spaced at 25.  The green lines are at the left edge of the text, and they are spaced at 25.6.

2) I changed the figure window size like you suggested.  Here is my output:

dx =
   25.6000
   25.6000

dy =
   24.8000   24.8000

The values of dx and dy did not change when I changed the figure window size.

3) You mentioned quantization, and so did Rune in an earlier post.  This is possible, but I would be surprised if it is this bad.  I'm not sure if this is the right comparison, but an error of 0.6 out of 1440 pixels across my screen isn't very good.  That would mean there is only about 12 bits of resolution.