1

I am plotting a ggplot2 graph that has an uneven number of facets. My plot currently looks 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) 

enter image description here

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

How can I achieve this? Thanks in advance for any hints.

thiagoveloso
  • 2,537
  • 3
  • 28
  • 57

0 Answers0