Adding greek character to axis title

前端 未结 6 1012
伪装坚强ぢ
伪装坚强ぢ 2020-11-29 03:37

I want to add a greek character to the y-axis of my barplot in R.
The problem is that I need this character to be integrated in the title. I want to write:



        
6条回答
  •  星月不相逢
    2020-11-29 03:44

    And if you want to substitute variables in the text, use bquote. For instance, if you have a variable mu and want to show it in the title, then use the following idiom:

    mu <- 2.8
    plot(1:3, main=bquote(mu == .(mu)))
    

    The part enclosed in .() will be substituted, so that the value of mu will be printed and not the greek "mu" character. Consult the R help on bquote for details.

    enter image description here

提交回复
热议问题