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?

 Réponse acceptée

Walter Roberson
Walter Roberson le 15 Jan 2014

0 votes

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.

Plus de réponses (1)

Rafael
Rafael le 15 Jan 2014
Modifié(e) : Walter Roberson le 15 Jan 2014

0 votes

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 commentaires

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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Labels and Annotations dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by