How to descrease the size of a textbox

LS,
I would like to decrease the size around the text that is plotted in a graph. I need a background color to make the text readable but the box is now too large. Is there a way to decrease the size of the text box?
Best,
Frits

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2011 年 6 月 29 日

0 投票

h=text(.5,.5,'this is my text','BackgroundColor',[.5 .5 .5]);
get(h)
to see a list of the properties, use set(h) to change the properties. Maybe the 'Position' is the property that you are looking for?
set(h,'BackgroundColor',[1 0 0])

3 件のコメント

Frits
Frits 2011 年 6 月 29 日
Hi Fangjun,
Thanks a lot for your answer. Unfortunately I cannot find a property that decreases the size of the textbox.
If you have another suggestion please let me know.
Best,
Frits
Fangjun Jiang
Fangjun Jiang 2011 年 6 月 29 日
I have not found the right properties yet. Maybe need more poking around. But what I saw is the box is closely around the text. What do you mean the textbox is too large? Can you show a sanpshot?
Fangjun Jiang
Fangjun Jiang 2011 年 6 月 29 日
Try this:
set(h,'Margin',40)
and then set it to be 1.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

製品

質問済み:

2011 年 6 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by