Hold text in different monitors

I'm having a little problem in my script, in my work i have to show a graph and a lot o values and data in it. I'm using the function "text", this function works fine, but when i go to another computer with a monitor with different size, the text goes to a different place, how do i hold the text in the same position in differents monitors?

 Accepted Answer

Walter Roberson
Walter Roberson on 15 Jan 2014
By default, text() uses Data coordinates for the positioning. You can set a different Units property to use a different base.
The size of text is controlled by its FontUnits, which defaults to "points".
If you use the defaults, "data" and "points", then you use monitors with different resolutions, or figures of different sizes, the relative positions of the text anchor points should stay the same, but the text will occupy less or more space on the screen.
If you set the axes position units to pixels, and the text Units and FontUnits to pixels, then the relative positions and sizes should be consistent; however you might encounter clipping if the one of the monitors does not have enough pixels.

More Answers (1)

Rafael
Rafael on 15 Jan 2014
Edited: Walter Roberson on 15 Jan 2014
How do i do this in practice?
what i do is this.
text(-22,8,'Im = ','FontWeight','bold');
text(-22,7,'Pole lat. = ','FontWeight','bold');
string3 = {num2str(latpolototal,'%0.1fº')};
string4 = {num2str(longpolototal,'%0.1fº')};
text(-18.5,7,string3); % Latitude do polo
text(-18.1,6,string4); % Longitude do polo
but in other monitor, the position changes.

2 Comments

text(183,59,'Im = ','FontWeight','bold', 'Units', 'pixels'); %for example
it worked, thanks a lot!

Sign in to comment.

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Tags

Asked:

on 15 Jan 2014

Commented:

on 15 Jan 2014

Community Treasure Hunt

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

Start Hunting!