In the following example data frame, I would like to have 2 segments y-axis (break in the y-axis) for better resolution in visualisation of smaller values in "lna1". I have already tried facet_wrap but I would like to use facet_grid for comparison of genes with same y-scale.
df<-data.frame(stimulation=rep(rep(c("a","b","c"), each=3),2),
LNA=rep(c("lna1","lna2"),each=9),
foldchange=c(5,6,7,10,11,12,4,3,2,40,45,55,7,8,10,99,100,101))
n <- 3
df<-do.call("rbind", replicate(n, df, simplify = FALSE))%>%
mutate(genes=rep(c("gene1","gene2","gene3"), each=18))
ggplot(df, aes(x=LNA, y=foldchange,fill = stimulation))+
geom_point() +
geom_boxplot(alpha = 0.2) +
theme(axis.text.x = element_text(angle = 60, hjust = 1)
,legend.background = element_rect(fill = "white", colour = NA)) +
geom_hline(yintercept = 1) +
scale_x_discrete(limits=c("lna1","lna2")) +
facet_grid(stimulation~genes, scales="free")