%% Create Text Box Annotation
% Create a simple line plot and add a text box annotation to the figure.
% Specify the text description by setting the |String| property.
% 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 = [.2 .5 .3 .3];
str = 'Straight Line Plot from 1 to 10';
annotation('textbox',dim,'String',str,'FitBoxToText','on');

%% 
% Create a text box annotation without setting the |FitBoxToText| property.
% The text box uses the specified width and height and wraps text as
% needed.

figure
plot(1:10)
dim = [.2 .5 .3 .3];
str = 'Straight Line Plot from 1 to 10';
annotation('textbox',dim,'String',str)


