MATLAB Answers

Is it possible to create textbox with fixed width on a plot?

21 views (last 30 days)
Mr M.
Mr M. on 26 May 2015
Answered: Ashish Gudla on 27 May 2015
I would like to add paragraph with fixed width as a caption to the figure, but I don't want to set by hand the linebreaks!

  0 Comments

Sign in to comment.

Answers (1)

Ashish Gudla
Ashish Gudla on 27 May 2015
You can use the annotation textbox with the 'FitBoxToText' property set to 'off'. This will wrap the text to fit the width of the text box.
Ex:
>>figure; % new figure window
>>plot(1:10);
>>annotation('textbox', [0.2,0.4,0.5,0.1],...
'String', 'This is a test string.This is a test string.This is a test string.This is a test string.',...
'FitBoxToText','off');
You can refer to other properties here:

  0 Comments

Sign in to comment.