I want to place a common legend for my three plots in the slot where the fourth plot would go (highlighted in yellow). How can I do this?
Code to reproduce plots
par(mfrow = c(2, 2))
x <- rep(1:9, 3)
y <- sample(1:9, 27, replace = T)
group <- rep(1:3, each = 9)
for(i in 1:3){
plot(x = x, y = y, type = "n")
for(j in 1:3){
print(c("red", "blue", "green")[group])
lines(x = x[group == j],
y = y[group == j],
col = c("red", "blue", "green")[j])
}
}

