Faceting Attributes - janeshdev/ggplot2 GitHub Wiki
Faceting Attributes
Base Plot
#create simple dataframe for plotting
xy <- data.frame(x = rep(1:10, times=3), y = rep(10:1, times=3), type = rep(LETTERS[1:2], each=5), type2 = rep(LETTERS[3:5], each=10))
#create base plot
plot <- ggplot(data = xy)+
geom_point(aes(x = x, y = y))+
facet_grid(type ~ type2)
#plot base plot
plot
strip.background (rect)
#
plot + theme(strip.background = element_rect(colour = 'purple', fill = 'pink', size = 3, linetype='dashed'))
strip.text.x (text)
#
plot + theme(strip.text.x = element_text(colour = 'red', angle = 45, size = 10, hjust = 0.5, vjust = 0.5, face = 'bold'))
strip.text.y (text)
#color doesn't work, need colour
plot + theme(strip.text.y = element_text(colour = 'red', angle = 45, size = 10, hjust = 0.5, vjust = 0.75, face = 'italic'))
http://imgur.com/xAWsW.png #panel.margin ()
#big margins
plot + theme(panel.margin=unit(5 , "lines"))
#no margins
plot + theme(panel.margin=unit(0 , "lines"))