Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Faceting Attributes

Daniel E Cook edited this page · 6 revisions
Clone this wiki locally

Faceting Attributes

Return to opts() list

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

panel.margin ()

#big margins
plot + theme(panel.margin=unit(5 , "lines"))
#no margins
plot + theme(panel.margin=unit(0 , "lines"))

Something went wrong with that request. Please try again.