问题
I want to write my figure title in two lines in a way that I can change the text properties of both lines separately. I found:
title(['\bf{first line}' char(10) '\rm{second line}'])
which makes the first line bold. But how can I change the font size for first line?
回答1:
title(['\fontsize{20pt}\bf{first line}' char(10) '\fontsize{10pt}\rm{second line}'])
I found this syntax hidden in the docs: http://www.mathworks.com/help/matlab/creating_plots/adding-text-annotations-to-graphs.html#f0-19466 And then fiddled it bit.
回答2:
I'm with Dan, but I'd leave out the unintuitive char(10)
and use vertically-concatenated cell-arrays:
title({...
'\fontsize{25pt}\bf{first line}'
'\fontsize{8pt}\rm{second line}'
})
Result:

Nothing new, just a but more intuitive and readable.
来源:https://stackoverflow.com/questions/16189031/changing-font-in-a-two-line-figure-title