MATLAB Answers

Ben
0

Multiline title not fitting in figure window

Asked by Ben
on 18 Mar 2016
Latest activity Commented on by Ben
on 21 Mar 2016
Accepted Answer by Jan
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
on 19 Mar 2016
It depends. Do you want to move the axes object down? Do you want to decrease the scaling?
Sure moving the axes down is fine, but I was having a hard time determining the exact amount needed.

Sign in to comment.

Tags

1 Answer

Answer by Jan
on 19 Mar 2016
 Accepted Answer

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

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.