MATLAB: Text out on axes

axesguitext;

I load an image onto an axes and want to display text in the top left hand corner. As I often display the image at different zoom factors, using the text using x,y wont work for all Zoom factors. Is there away to say irrespective of zoom, always plot at a certain coordinate on the underlying axes?

Best Answer

Yes, text has a 'Units' property. If you set this to one of the "screen space" units (I just made that term up), then it is relative to the lower-left corner of the axes.
For example:
text(2*72, 1*72, 'My String', 'Units', 'points')
Will create a text string which stays 2 inches in from the left and 1 inch up from the right (a point is 1/72 inch), even when you pan or zoom.
Related Question