The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: text positioning bug (converting units)
Replies: 2   Last Post: Jul 12, 2014 9:28 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Paul Mennen

Posts: 311
Registered: 12/7/04
text positioning bug (converting units)
Posted: Jul 12, 2014 3:48 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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 + 1e-30) % the text moves a lot!

Pretty strange behavior. 1e-30 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?


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.