I am using ggplot2 with facet grid to make a graph of pie charts that have different sizes depending on the sample size. I would like the background of the pie charts have a different colour depending on again a different variable (yes I know this is a lot of information in one graph, but in the end it will give the best overview of our results). However if I use the answer given here my pie charts disappear and the colours get disrupted between geom_rect and geom_bar. Is there a way to change the background colour without fiddling with the colours of the pie charts?
My current code is as follow:
ggplot(test,aes(x=No._plants_EW/2,y= No._HR,fill=HR,width=No._plants_EW)) +
geom_bar(stat="identity",position="fill") + facet_grid(phylo ~ LineNumber) +
coord_polar("y") +
scale_fill_manual(values=c("HRMin"="grey54", "HRPlus"="#E69F00")) +
blank_theme +
theme(axis.text.x=element_blank(),axis.text.y=element_blank()) +
theme(strip.text.y = element_text(angle = 0, hjust=0.5))
Thank you very much for all your help!