更新:opts
廃止されました。この回答でtheme
説明されているように、代わりに使用してください。
kohske's answer を拡張するだけなので、次の人がそれに出くわすのはもう少し包括的です。
mtcars$cyl <- factor(mtcars$cyl, labels=c("four","six","eight"))
library(gridExtra)
a <- ggplot(mtcars, aes(x=wt, y=mpg, colour=cyl)) + geom_point(aes(colour=cyl)) +
opts(legend.justification = c(0, 1), legend.position = c(0, 1), title="Legend is top left")
b <- ggplot(mtcars, aes(x=wt, y=mpg, colour=cyl)) + geom_point(aes(colour=cyl)) +
opts(legend.justification = c(1, 0), legend.position = c(1, 0), title="Legend is bottom right")
c <- ggplot(mtcars, aes(x=wt, y=mpg, colour=cyl)) + geom_point(aes(colour=cyl)) +
opts(legend.justification = c(0, 0), legend.position = c(0, 0), title="Legend is bottom left")
d <- ggplot(mtcars, aes(x=wt, y=mpg, colour=cyl)) + geom_point(aes(colour=cyl)) +
opts(legend.justification = c(1, 1), legend.position = c(1, 1), title="Legend is top right")
grid.arrange(a,b,c,d)