MATLAB Answers

Multiline title not fitting in figure window

14 views (last 30 days)
Ben
Ben on 18 Mar 2016
Commented: Ben on 21 Mar 2016
I'm having trouble getting a multiline title to fit into the figure window. For example how can I ensure that all of the lines of the following title are visible?
img=imread('cameraman.tif');
imshow(img)
title({'Line 1','Line 2','Line 3'})

  2 Comments

Jan
Jan on 19 Mar 2016
It depends. Do you want to move the axes object down? Do you want to decrease the scaling?
Ben
Ben on 21 Mar 2016
Sure moving the axes down is fine, but I was having a hard time determining the exact amount needed.

Sign in to comment.

Accepted Answer

Jan
Jan on 19 Mar 2016
Can you use image instead of imshow?
AxesH = axes('NextPlot', 'add', 'Visible', 'off');
title({'Line 1','Line 2','Line 3'}, 'Visible', 'on')
image(rand(100, 100, 3), 'Parent', AxesH);
axis(AxesH, 'image')

  1 Comment

Ben
Ben on 21 Mar 2016
Yeah that should work. I'll have to figure out how to modify the image display range like I was doing with imshow, but I'm sure there is a way. Any pointers?

Sign in to comment.

More Answers (0)

Tags