删除ggplot2中构面的右边界

我找到了有关删除单个图的右边界的帖子,但找不到有关删除构面的右边界的帖子。例如,考虑以下代码产生的构面,是否可以删除每个构面的右边界?

    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"))

在此处输入图片说明

hrbrmstr

除非我弄错了,否则这将是您将要做的最好的事情:

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

在此处输入图片说明

我会尝试调整刻度线的大小,以确保它们与假轴匹配。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章