www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/MultilineTextBoxAnnotationExample.m

    %% Create Text Box Annotation with Multiline Text
% Create a text box annotation with multiline text by setting the |String|
% property to a cell array. Each element of the cell array displays on a
% separate line. Force the box to fit tightly around the text by setting the 
% |FitBoxToText| property to |'on'|.

% Copyright 2015 The MathWorks, Inc.


figure
plot(1:10)
dim = [0.2 0.5 0.3 0.3];
str = {'Straight Line Plot','from 1 to 10'};
annotation('textbox',dim,'String',str,'FitBoxToText','on');