Can someone please guide me how to create legends like the ones on chapter 1? Seems like they are in two columns. Below the example from the book, my code and my result.
plot(y = Et, x = t, type = "l", col = 1, xlab = "Time", ylab = "Equity ($)", main = "Figure 1.3: Randomly Generated Equity Curves")
grid()
abline(h = 10000)
lines(y = Et2, x = t, col = 2)
lines(y = Eb, x = t, col = 8)
legend(x = "topleft", col = c(1, 2, 8), lty = c(1, 1), lwd = 2, ncol = 2, title = "NPMD Burke",
cex = 0.5,
legend = c(
paste0(round(NPMD_Et, 2)),
paste0(round(NPMD_Et2, 2)),
paste0(round(NPMD_Eb, 2)),
paste0(round(Burke_Et, 2)),
paste0(round(Burke_Et2,2)),
paste0(round(Burke_Eb, 2))
))