I am trying to justify multiple legend in ggplot, but without any real success. When displaying legend outside plot region (grey area) justification is correct. However, when displaying legends inside plot region, legends are centered (and I would like to make them be left-sided aligned). I have tried to follow this thread but it still does not work properly.
My example:
library(ggplot2)
ggplot(mtcars, aes(wt, mpg)) +
geom_point(aes(colour = factor(cyl), size = qsec)) +
geom_point(aes(colour = factor(cyl), size = qsec)) +
theme(legend.justification = c(1,0),
legend.position = c(1,0),
legend.margin = unit(0,"lines"),
legend.box = "vertical",
legend.key.size = unit(1,"lines"),
legend.text.align = 0,
legend.title.align = 0)