Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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: 635
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$1@newscl01ah.mathworks.com>...
> "matt dash" wrote in message <kc2kpn$e0i$1@newscl01ah.mathworks.com>...
> > 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:
> http://UndocumentedMatlab.com/blog/pinning-annotations-to-graphs/
>
> Yair Altman
> http://UndocumentedMatlab.com
>


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]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.