How to show a text on screen at the coordinates I give

Answers (1)

There is no good way to do this. text() is the only routine to place text on the screen that is not part of a user interface control, but text() always draws relative to an underlying axes, and text() always uses data coordinates. You would have to position an axes (which can be done in pixel coordinates), and draw on the axes, having carefully set your XLim and YLim to get the right positioning.
You can do something like
h = uicontrol('Style', 'text', 'Units', 'pixels', 'Position', [400 500 450 521], 'String', 'Hello')
This will, however, put the text within a box, rather than just painting the text on top of whatever else is there.

Asked:

on 24 Jun 2012

Community Treasure Hunt

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

Start Hunting!