Mihai Todor
Mihai Todor

Reputation: 8239

Adding text below text box

I have a text item on one of my plots, placed at a certain location, with a certain orientation:

th=text(x,y,'some text','HorizontalAlignment','right','rotation',rot);

Based on its position (get(th, 'Position')), or any other property, is there any way to compute the lower bound of its bounding box? I want to place another text just below it.

Upvotes: 0

Views: 148

Answers (1)

Jetpac
Jetpac

Reputation: 2125

You could use the Extent property. You will probably need to tweak the alignments depending on what you're after, but something like this:

th = text(x,y,'some text','HorizontalAlignment','right','rotation',rot);
ex = get(th,'Extent');
text(ex(1),ex(2),'Text Below')

Upvotes: 1

Related Questions