Facet labels involving a greek symbol

前端 未结 2 1362
野的像风
野的像风 2021-02-10 07:22

Suppose I have the data and plot as follows:

mydata = data.frame(x=rnorm(4), y=runif(4), tau=c(0,0,1,1))
ggplot(mydata) + geom_point(aes(x=x, y=y)) + facet_wrap(         


        
2条回答
  •  终归单人心
    2021-02-10 07:51

    There is an easier solution to this. The simulated data variable names have been changed for clarity in how they work within the labeller argument.

    mydata = data.frame(x=rnorm(4), y=runif(4), tauvar=c(0,0,1,1),sigmavar=c(2,2,3,3))
    
    ggplot(mydata) + 
       geom_point(aes(x=x, y=y)) +
       facet_grid(sigmavar ~ tauvar,labeller = label_bquote(sigma==.(sigmavar),
                                                       tau==.(tauvar)))
    

提交回复
热议问题