I am trying to arrange 2 plots created using ggplot2
and would like the plots to be the size of a square and one next to the other, with the common legend next
I'm not sure what you expect for the output, but try this,
g = arrangeGrob(
arrangeGrob(p1 + coord_fixed() + theme(legend.position="none"),
p2 + coord_fixed() +theme(legend.position="none"),
main = textGrob("The main figure title is also small and hard to align left", x=0, hjust =0, vjust=1, gp = gpar(fontsize = 22)), nrow=1),
mylegend, widths=unit.c(unit(1, "npc") - sum(mylegend$width),
sum(mylegend$width)), nrow=1)
ggsave("layout.pdf", g, width=12, height=5)