I am plotting a ggplot2
graph that has an uneven number of facets. My plot currently looks something like this:
library(ggplot2)
df <- data.frame(group=c(1,1,2,2,3),
name=c('a','b','c','d','e'),
x=c(1,2,3,4,5),
y=c(2,3,4,5,6))
ggplot(df, aes(x,y)) + geom_point() + facet_wrap(~ name, ncol=3)
Note that the default positioning for the facets is:
a b c
d e
However, I would like to have a finer control on the positioning of the facets. Specifically, I would like to "center" the bottom two facets in order to distribute the void space more evenly on the sides of the plot.
In other words, the ideal placement for me would look like:
a b c
d e
Is this something that can be achieved with ggplot2
? How? Many thanks in advance.