Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



text positioning bug (converting units)
Posted:
Jul 12, 2014 3:48 AM


Is this a known bug?
>> axis >> t = text(.8,.8,'abcd'); >> get(t,'position')
ans = 0.8000 0.8000 0
>> for k=1:200 set(t,'units','pixels'); set(t,'units','data'); end; >> p = get(t,'position')
ans = 0.3399 0.2149 0 % but the text has not actually moved
>> set(t,'position',p) % the text still does not move! >> set(t,'position',p + 1e30) % the text moves a lot!
Pretty strange behavior. 1e30 is about 27 orders of magnitude smaller than any distance your eye could possibly perceive, so it is surprising when the text would move a few inches when adding such a small number.
What appears to be happening is that (precisely) a one pixel error in both x and y is introduced every time you switch units. This was in Matlab 2009b under Win7, but I also tried it in a much older version (Matlab 6.1 from 13 years ago) under WinXP and it seemed to do the same crazy thing.
I was wondering if someone was willing to try this in a more recent version of Matlab to see if it has been fixed?
~Paul



