How add multi line title to figure (not to plot)?

Hello, I have a task to create figure to display the image with title of two rows: the image name as a first row and the second row the statistics “mean = …, max = …., min = …| as second rows. i know create multi line title for plot.
plot(x,y)
title({'first row','Second row'})
but how create two row title for figure? i am trying
figure('Name',{'first row','Second row'})
but get error: Error using figure While setting the 'Name' property of 'Figure': Value must be a string.
Thanks for help

Respuestas (2)

dpb
dpb el 26 de Jul. de 2017

0 votos

Unsupported feature, sorry. Find another task...or change assignor's expectations. :)

2 comentarios

Maxim Roshior
Maxim Roshior el 26 de Jul. de 2017
Hi, thanks. i think you right, because i am try a lot of things, but not get results. May be it is my mistake and i need to use only title function.
It's inherent in the underlying OS figure primitives; they don't support that feature in the title. If you'll look at figure properties there's no 'Interpreter' property so that \n isn't recognized and is stripped/ converted to space. Try
>> s=sprintf('%s\n%s','first row','Second row')
s =
first row
Second row
>>
>> figure('Name',s)
>> ft=get(1,'name')
ft =
first row
>>
Note there's only one line displayed on retrieval as opposed to two that were sent. Prove it:
>> double(ft)
ans =
102 105 114 115 116 32 114 111 119
>>
'32' is blank, not '\n'
You're beating a dead horse here. Sometimes you just can't do anything you want no matter how hard you try.

Iniciar sesión para comentar.

Jan
Jan el 26 de Jul. de 2017
The name of the figure appears in the border of the window. There is only space for a single line. Do you want to the figure title to appear inside the window? This is possible:
figure;
AxesH = axes('Units', 'normalized', 'Position', [0,0,1,1], 'Visible', 'off');
text(0.5, 1, {'First line', 'second line'}, 'Parent', AxesH, ...
'HorizontalAlignment', 'center', 'VerticalAlignment', 'top');

Preguntada:

el 26 de Jul. de 2017

Comentada:

dpb
el 26 de Jul. de 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by