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"))
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.