Reputation: 377
I found posts about removing the right border of a single plot, but could not find posts about removing the right border of facets. Considering the facets produced by the following codes for example, is it possible to remove the right border of each facet?
library(reshape2)
library(ggplot2)
sp <- ggplot(tips, aes(x=total_bill, y=tip/total_bill)) + geom_point(shape=1)
sp + facet_wrap( ~ day, ncol=2) + theme_bw() +
theme(strip.text = element_text(size=12,colour="black"),
strip.background = element_rect(colour="white", fill="white"))
Upvotes: 1
Views: 3858
Reputation: 78842
Unless I'm mistaken, this is prbly the best you're going to be able to do:
library(reshape2)
library(ggplot2)
sp <- ggplot(tips, aes(x=total_bill, y=tip/total_bill))
sp <- sp + geom_point(shape=1)
sp <- sp + geom_hline(yintercept=0)
sp <- sp + geom_vline(xintercept=0)
sp <- sp + scale_x_continuous(expand=c(0,0))
sp <- sp + scale_y_continuous(expand=c(0,0))
sp <- sp + facet_wrap(~day, ncol=2)
sp <- sp + theme_bw()
sp <- sp + theme(panel.border=element_blank(),
strip.text=element_text(size=12, colour="black"),
strip.background=element_rect(colour="white",
fill="white"))
sp
I'd prbly try to tweak the tick size to ensure they match the faux axes.
Upvotes: 4