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

    %% Add Text Box with Multiple Lines to Graph
% Insert multiple lines in a text box by creating a cell array of strings.
% Each element is used as a separate line.

% Copyright 2015 The MathWorks, Inc.


figure
plot(1:10)
str = {'Straight Line', 'Plot of 1 to 10'};
annotation('textbox', [0.2,0.4,0.1,0.1],...
           'String', str)