I have been trying to use geom_boxplot()
instead of geom_point()
in the following plot, but unfortunately, I have been getting errors.
Also, I want to keep the relevant ticks on the x-axis (i.e. remove 20 and 40 from the x-axis).
Finally, is it possible to include mathematical expressions in the title of the sub-plots?
My code is
n=48
p=7
df=data.frame(BIAS = c(rnorm(n*p,2,.01),rnorm((n+10-2),4),rnorm(n*p,1.5,.01),rnorm((n+30-2),1),rnorm(n*p,1,.01),rnorm((n+50-2),0)),
ID = rep(c(10,30,50),c((n*p+(n+10-2)),(n*p+(n+30-2)),(n*p+(n+50-2)))),
TYPE = rep(c("DELTA","PSI","DELTA","PSI","DELTA","PSI"),c(n*p,(n+10-2),n*p,(n+30-2),n*p,(n+50-2))))
ggplot(df,aes(x=ID ,y=BIAS, color=TYPE)) +
geom_point() +
facet_wrap(~TYPE,scales = "free")+
theme_bw() + xlab("T") + ggtitle("N = 48")
Your help is appreciated