5

I'm trying to combine a few Matlab plots into one figure and therefore I'm wondering how I can create 'normal' tiles above my plots instead of the bold titles provided by Matlab. Below an example.

figure
plot((1:10).^2)
title({'First line';'Second line'})
6
  • I assume you want to remove the bold font? add '\bf your title' as described here uk.mathworks.com/help/matlab/ref/title.html Jan 12, 2016 at 9:35
  • Or are you trying to label a title for each of the plots you are combining? In which case you should use subplot and issue an individual title for each of your subplots. Jan 12, 2016 at 9:39
  • @GameOfThrows shouldn't that be \sl?
    – Dan
    Jan 12, 2016 at 9:41
  • @Dan Actually, I think \rm maybe the one he is looking for. I just remember \bf as bold font. Jan 12, 2016 at 9:51
  • 1
    True that, apologies. \rm is indeed what I was looking for. Thanks!
    – Tim
    Jan 12, 2016 at 9:53

1 Answer 1

8

Make use of the 'FontWeight' argument:

figure
plot((1:10).^2)
title({'First line';'Second line'},'FontWeight','Normal')

Note also that you can access the 'FontWeight' argument for all text objects in your figure in one go---in case you have, e.g., several subplots in your figure---using findall:

myFig = figure;
subplot(2,1,1)
plot((1:10).^2)
title('First plot')
subplot(2,1,2)
plot((1:10).^2)
title('Second plot')

% Set 'Normal' font weight in both titles above
set(findall(myFig, 'Type', 'Text'),'FontWeight', 'Normal')

As stated in the comments above; for a single figure title, you can make use make use of \rm as an alternative. Note however that \rm depends on the (default) choice of 'Interpreter' as 'tex', whereas the approach above is valid for all choices of interpreter (however with no effect for text objects using interpreter 'latex').

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.