How to modify title (size or position)?

700 views (last 30 days)
I'm new to Matlab and am working off a previously set up template. I'm having difficulties with my title. The template is set up so that four different views are saved and the title is floating. When I print the graphs it cuts off half of the title. Is there a way to either shrink the size of the text or to move it down to fix to the problem?
Below is the current code. How would I modify it to fix this problem?
title({'May 10, Run 6 | MN'});
ylabel('Temperature (K)')
xlabel('\lambda (nm)')
zlabel('Counts')
axis([300 550 110 350])
Thank you for your help!

Accepted Answer

Image Analyst
Image Analyst on 10 May 2013
Edited: Image Analyst on 10 May 2013
You didn't post a screenshot, so I'm not sure what the problem is, but try this code:
fontSize = 14; % Whatever you want.
caption = sprintf('May 10, Run 6\nMN');
title(caption, 'FontSize', fontSize);
ylabel('Temperature (K)', 'FontSize', fontSize)
xlabel('\lambda (nm)', 'FontSize', fontSize)
zlabel('Counts', 'FontSize', fontSize)
axis([300 550 110 350])
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
When you create the string, such as caption like I did, put in a backslash n wherever you want it to go to the next line.

More Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 10 May 2013
title({'May 10';' Run 6 | MN'});

Community Treasure Hunt

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

Start Hunting!