R legend ggplot2 code example
Example 1: ggplot legend size
plot + theme(legend.key.size = unit(2, "cm"))
Example 2: ggplot put legend in plot
p + theme(legend.position = c(0.8, 0.2))
plot + theme(legend.key.size = unit(2, "cm"))
p + theme(legend.position = c(0.8, 0.2))