f



Position of Text

Hi All,

   Consider two different approaches of adding a text string on a
figure
1. "Insert"->"TextBox".
2. gtext or text(x, y, string)

   It is found that in approach 1, the text added always stay in the
same position no matter how I zoom the figure, but not the case for
approach 2. Can anyone explain? What I want is adding a text on a
figure by approach 2 but need it always stay in the same position.

Thanks,
cfy30
0
cfy301 (90)
1/29/2006 1:52:05 AM
comp.soft-sys.matlab 211266 articles. 23 followers. lunamoonmoon (257) is leader. Post Follow

3 Replies
398 Views

Similar Articles

[PageSpeed] 17

cfy30 wrote:
> Hi All,
>
>    Consider two different approaches of adding a text string on a
> figure
> 1. "Insert"->"TextBox".
> 2. gtext or text(x, y, string)
>
>    It is found that in approach 1, the text added always stay in the
> same position no matter how I zoom the figure, but not the case for
> approach 2. Can anyone explain?

If I were to make a guess, I'd suggest method 1 inserts the textbos as
a
child of the figure itself, while method 2 inserts the text as a child
of 
the axis.

Rune

0
allnor (8509)
1/29/2006 7:58:50 AM
cfy30 wrote:
>
>
> Hi All,
>
> Consider two different approaches of adding a text string on a
> figure
> 1. "Insert"->"TextBox".
> 2. gtext or text(x, y, string)
>
> It is found that in approach 1, the text added always stay in
> the
> same position no matter how I zoom the figure, but not the case for
> approach 2. Can anyone explain? What I want is adding a text on a
> figure by approach 2 but need it always stay in the same position.
>
> Thanks,
> cfy30

Hi!

Create a figure and use "insert > textbox". Right click the
textbox and choose "Show m-code". Now you have the code needed to
recreate the text. You can see that Rune�s guess about the text being
a child of the figure object was correct.

/PB
0
PB
1/29/2006 8:50:38 AM
PB wrote:
>
> cfy30 wrote:
    8><-- snip-- 8>< -----
>> 1. "Insert"->"TextBox".
>> 2. gtext or text(x, y, string)
>
> Create a figure and use "insert > textbox". Right click the
> textbox and choose "Show m-code". Now you have the code needed to
> recreate the text. You can see that Rune�s guess about the text
> being
> a child of the figure object was correct.

To be more precise, the first approach creates a separate axis
(Tagged 'scribeOverlay') that is a Children of the figure and the
Parent of teh text box (that is a hggroup object). This axis is the
annotation layer in which all the interactive plotting tools put the
created objects. But the Show m-code will work fine, unless you wish
to have your own coordinate system (e.g. following the main plot). If
so I would create my own axis covering the whole figure and settting
XLim and YLim to my needs. In this case you also need to take care to
not zoon this invisible figure by putting the axis at the bottom of
the list of figure childrens. Checkout the FEX contribution STAMPIT
for a suggested solution (this one has worked fine for me so far).

just my 0.02 kr

Lars
0
1/29/2006 9:47:50 PM
Reply: