I have 4 plots which I have merged/wrapped into 2x2 plots using facet_wrap()
. But I am unable to fix the labels of the plots.
Here are my codings.
labelp = c('0.6' = expression(paste(phi, ""[0], " = 0.60")),
'0.7' = expression(paste(phi, ""[0], " = 0.70")),
'0.8' = expression(paste(phi, ""[0], " = 0.80")),
'0.9' = expression(paste(phi, ""[0], " = 0.90")))
ggplot(data,aes("x" = N, "y" = alpha))+
geom_ribbon(aes(ymin = low, ymax = upp), fill = "grey")+
geom_point()+
facet_wrap(~p, nrow = 2, labeller = as_labeller(labelp))+
labs("y" = "Type I error rates")
I would like to change label for each plots. Meaning, instead of $0.6$, I want $\phi_0 = 0.60$ and so on. How should I edit my labeller for facet_wrap()
?
I read about label_parsed
so I have tried using that. Here is my code.
labelp = as_labeller(c('0.6' = "Phi[0] = 0.60", '0.7' = "Phi[0] = 0.70",
'0.8' = "Phi[0] = 0.80",'0.9' = "Phi[0] = 0.90"),
default = label_parsed)
ggplot(data,aes("x" = N, "y" = alpha))+
geom_ribbon(aes(ymin = low, ymax = upp), fill = "lightblue")+
geom_point()+
geom_hline(yintercept = 0.05, linetype = "dashed")+
facet_wrap(~p, nrow = 2, labeller = labelp)+
labs("y" = "Type I error rates")
This codes resulted in this figure:
Both are not what I want. Any clues how to fix this?