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: Error in 'pixelbounds'
Replies: 2   Last Post: Jan 4, 2013 11:45 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
matt dash

Posts: 641
Registered: 4/18/08
Re: Error in 'pixelbounds'
Posted: Jan 4, 2013 11:45 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Yair Altman" wrote in message <kc3hk7$grl$>...
> "matt dash" wrote in message <kc2kpn$e0i$>...
> > I realize it's undocumented for a reason, but i've noticed that sometimes when i'm using the opengl renderer, getting an axes pixelbounds gives an extremely wrong answer sometimes. (And then sometimes doing the exact same process it works just fine). To add to the debugging difficulty, it always gives the correct answer if there is a debug breakpoint anywhere in any mfile.
> >
> > By any chance has anyone found a line of code i could put before get(...,'pixelbounds') to ensure that it always gives correct values? Drawnow/pause don't fix it.

> Hi Matt,
> As I wrote in my book, PixelBounds is unreliable and quite often returns invalid data. While it is much faster than using getpixelposition, remember the adage that a wrong answer is always infinitely slower than a correct one.
> A few times over the past years I've asked MathWorks to fix PixelBounds, but instead I received a hint that they are actually planning to remove the property altogether (which has still not happened, but who knows). I'd be most happy to learn otherwise.
> If you want to convert an axes graphic object to pixel position, you can use the short code within %matlabroot%/toolbox/matlab/scribe/@scribe/@scribepin/topixels.m. It also relies on undocumented properties and internal DLL functions, by the way. I described its usage recently, in my article on pinning figure annotations to an axes:
> Yair Altman

Thanks for the info, Yair. I have your book but I didnt have it with me when i ran into this problem!

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.