If I have data.frame dat and you want to display data groups using facet_wrap :
dat <- data.frame(x = runif(150), y = runif(150), z = letters[1:15]) ggplot(dat[dat$z %in% letters[1:9], ], aes(x, y)) + geom_point() + facet_wrap( ~ z, ncol = 3, nrow = 3)
It looks great and works as expected. However, if I built the following set of z on a new chart:
ggplot(dat[dat$z %in% letters[10:15], ], aes(x, y)) + geom_point() + facet_wrap( ~ z, ncol = 3, nrow = 3)
I no longer have three rows and 3 columns. I can correct the proportions of the graphs using opts(aspect.ratio = 1) , but I still have them differently, which is my previous plot. I would like it to look as if there are always 9 graphs on the page, even if there are 6 or 1. Is this possible?
Justin
source share