如何从facet_grid()中删除灰色背景(ggplot2)

cro*_*oss 2 r facet ggplot2

我有以下情节:

在此输入图像描述

通过执行获得:

ggplot() + 
  stat_summary( data = test_data1, aes(x=x, y=(1-value) , colour = as.factor(1) , lty = as.factor(1) ) , fun.y=mean, geom="line" ,  size=1 ) +
  stat_summary( data = test_data1, aes(x=x, y=(1-value) , colour = as.factor(1), shape=as.factor(1) ) , fun.y=mean, geom="point" ,  size=3, pch=21, fill="white" ) +
  stat_summary( data = test_data2, aes(x=x, y=(1-value) , colour = as.factor(2), lty = as.factor(2) ) , fun.y=mean, geom="line", size=1 ) +
  stat_summary( data = test_data2, aes(x=x, y=(1-value) , colour = as.factor(2), shape=as.factor(2)) , fun.y=mean, geom="point", size=3, pch=21, fill="white" ) +
  theme_bw(base_size = 14, base_family = "Palatino") + 
  theme(legend.key = element_blank() ) +
  expand_limits(x=c(0), y=c(0)) +
  facet_grid(distance ~ . ) 
Run Code Online (Sandbox Code Playgroud)

我该如何摆脱后面出现灰色背景的100200.

我希望它是白色的,而不会改变我目前正在使用的其他主题.

cro*_*oss 5

谷歌搜索,我发现这篇文章,解释了可以应用的不同操作facet.

事实证明,我的问题可以通过以下方式解决:

theme(legend.key = element_blank(), strip.background = element_rect(colour="red", fill="#CCCCFF") ) 
Run Code Online (Sandbox Code Playgroud)

使用strip.background = element_rect(colour="red", fill="#CCCCFF")内部theme()做的工作.