translating data coordinates to figure coordinates

3 views (last 30 days)
I've got a rectangle defined in data coordinates, trying to use dragrect to accurately move that rectangle elsewhere and redefine the rectangle a different location. My problem is translating data coordinates into figure coordinates for dragrect.
I used ds2nfu for a while, and it gets close, but I use daspect([1 1 1]) and get(gca,'Position') doesn't properly get the normalized axes size when one axis is smaller due to the aspect ratio constraint.
Everything I've tried is 'close' but I can't quite seem to get the proper scale factor for shrinking the constrained axis because get(gca,'TightInset') always gives a '0' when there is more room in an axes' width or height than it actually takes up (since there is no needed additional margin).
It'd be nice if get(gca,'TightInset') gave negative values, so you could properly determine exactly how wide an axis that is constrained by daspect is.
The other question is, have I been blind to an easier way to get this information?

Answers (0)

Categories

Find more on Labels and Annotations in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!