I am trying to label my facets in a facet grid plot using Greek character equalities, with a line break in between the two equalities.
The code I have used to generate this is the following:
set.seed(1)
outtown<-cbind(rep(1,100),runif(100,-100,100),runif(100,-100,100),rep(1,100))
colnames(outtown)<-c('hh_id','x','y','z')
outtown[,1]<-print(paste("alpha==",100,"\n beta==",200,sep=""))
outtown<-data.frame(outtown)
outtown[,1]<-as.factor(outtown[,1])
outtown[,2]<-as.numeric(as.character(outtown[,2]))
outtown[,3]<-as.numeric(as.character(outtown[,3]))
outtown[,4]<-as.factor(outtown[,4])
str(outtown)
library(ggplot2)
ev <- ggplot(outtown, aes(x = outtown[,2], y = outtown[,3])) +
geom_boxplot(mapping=aes(x=outtown[,2],y=outtown[,3],shape=1,colour=outtown[,1]),outlier.size = 0.5,lwd=0.3) +
scale_shape_identity() +
theme(axis.text.x=element_text(angle = 45, hjust = 1,size=5))
ev + facet_grid(z~hh_id,scale='free',labeller=label_parsed)+
xlab("Estimator") +
ylab("Bias") +
scale_color_discrete(name='Type of\nEstimator')
Although no error comes out, I get an image just showing the "alpha=100" part, but not another line underneath saying "beta=200". Here is the image:
Aside from the labels, how do I get it to say on the top facet "alpha=100" with "beta=200" underneath? Thank you