An editor instructed me to remove the gray background and grid lines and add black axis lines to a plot I created with ggplot2. I utilized cowplot and achieved most of the requested changes. However, one detail that remains missing is the vertical line for each plot. The output only includes the line in the leftmost plot, but I need to add a vertical line (y-axis) to each panel plot.
# example
y <- rnorm(300)
x <- rep(1:3,each=100)
library(ggplot2)
library(cowplot)
dat <- as.data.frame(x=x,y=y)
ggplot(dat,aes(y=y))+geom_boxplot()+facet_grid(~x)+theme_cowplot(12)
If
facet_grid
isn't really needed you could switch tofacet_wrap(~x, scales = "free_y")
and fix the limits of the y scale usingscale_y_continuous(limits = range(dat$y))
: