我按照this question中的步驟操作,並試圖用較大的字體設置單個文本對象。這裏是我的示例代碼:在增加字體大小後截斷標籤文本
hf = figure;
set(hf, 'DefaultAxesFontSize', 14)
hx = axes('Parent',hf);
[hx,hp1,hp2] = plotyy(hx, rand(10,1),rand(10,1),rand(10,1),rand(10,1),'scatter');
hlx = xlabel(hx(1), 'Only half of this line show up');
hl1 = ylabel(hx(1), 'Not usually truncated but less border');
hl2 = ylabel(hx(2), 'Only part of this line show up');
ht = title(hx(1), 'Too close to border');
從圖中可以看出,標籤被圖形的邊界截斷。爲了揭示所有文字,我必須將這個數字拖到非常大的位置 - 與所期望的相反 - 。
我怎麼能自動根據文本字體大小設置文本框,因此,即使是小圖他們沒有得到削減?
我知道我可以通過設置軸的Position
來手動完成它,但它是一種手動和猜測的嘗試。有沒有自動計算邊距的方法?