Changing font in a two line figure title

末鹿安然 提交于 2019-12-07 01:03:19

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!