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?

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 15 Jan. 2014

0 Stimmen

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.

Weitere Antworten (1)

Rafael
Rafael am 15 Jan. 2014
Bearbeitet: Walter Roberson am 15 Jan. 2014

0 Stimmen

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 Kommentare

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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Labels and Annotations finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 15 Jan. 2014

Kommentiert:

am 15 Jan. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by