How to use simultaneously superscript and variable in a axis label with ggplot2

后端 未结 1 1224
醉梦人生
醉梦人生 2021-01-06 01:36

I would like to use together a variable (here the vector element \"type\") and a unit containing a superscript (here m^2) inside n axis label.

data <- li         


        
相关标签:
1条回答
  • 2021-01-06 01:48

    It works with bquote:

    xlab(bquote('surface of' ~ .(type) ~ '/' ~ m^{2}))
    

    enter image description here

    0 讨论(0)
提交回复
热议问题