r - How to remove the grey background from a facet_grid() (ggplot2) -


this question has answer here:

i have following plot:

enter image description here

obtained executing:

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 ~ . )  

how rid of grey background appearing behind 100 , 200.

i white, without changing rest of theme using @ moment.

after googling bit more found this post, explains different manipulations can applied facet.

in turns out question can solved doing:

theme(legend.key = element_blank(), strip.background = element_rect(colour="red", fill="#ccccff") )  

using strip.background = element_rect(colour="red", fill="#ccccff") inside theme() work.


Comments