I'm trying to replicate a figure from a paper that shows a scatter plot with two sections zoomed in on either side. I thought using the facet_zoom function from ggforce would achieve this, but I can't get the figure to show both zoomed in plots.
The figure I want to replicate is this:
Here's what I've tried so far:
data <- data.frame(cbind(predictors_lst$group, log.concentrations))
cliff <- apply(data[,-1],2,cliff.delta,data$predictors_lst.group)
cliff.est <- t(data.frame(lapply(cliff, function(x) x$estimate)))
opls.model <- opls(data[,-1], data$predictors_lst.group, predI = 1, orthoI = 1)
opls.loadings <- abs(opls.model@loadingMN)
joined_df <- data.frame(cbind(cliff.est,opls.loadings))
colnames(joined_df) <- c("Cliff's delta","OPLS-DA loadings")
joined_df %>%
ggplot(aes(x=`Cliff's delta`,y=`OPLS-DA loadings`)) +
geom_point() +
geom_vline(xintercept = c(-0.6,0.6),
color = "red", size=1) +
geom_hline(yintercept = 0.035,
color = "red", size=1) +
facet_zoom(xlim = c(-0.6,-1), ylim = c(0.035,0.1)) +
facet_zoom(xlim = c(0.6,1), ylim = c(0.035,0.1))