I'm trying to make a facetted plot with two panels - left and right. The variable on the x-axis is continuous, and the variable on the y-axis is discrete, with relatively long labels. I would like to put the y-axis of the right hand side plot on the right side (and keep the y-axis of the left hand side left), so that the two panels are not split apart by the y-axis labels of the right hand side plot.
I've tried a couple of different workaround (e.g. cowplot) but I can't get anything that I would be satisfied with, because I also need a legend in my plot.
Here's a reprex:
library(tidyverse)
region <- sample(words, 20)
panel <- rep(c(0, 1), each = 10)
value <- rnorm(20, 0, 1)
df <- tibble(region, panel, value)
ggplot(df, aes(value, region)) +
geom_point() +
facet_wrap(~ panel, scales = 'free_y')
Thank you!


