Die Funktion legend()

Mit der Funktion legend() kann man einem Diagramm eine Legende hinzufügen:

legend(x, y = NULL, legend, fill = NULL, col =  par("col"),
       border = "black", lty, lwd, pch,
       angle = 45, density = NULL, bty = "o", bg = par("bg"),
       box.lwd = par("lwd"), box.lty = par("lty"), box.col = par("fg"),
       pt.bg = NA, cex = 1, pt.cex = cex, pt.lwd = lwd,
       xjust = 0, yjust = 1, x.intersp = 1, y.intersp =  1,
       adj = c(0, 0.5), text.width = NULL, text.col = par("col"),
       merge = do.lines && has.pch, trace = FALSE, plot = TRUE,
       ncol = 1, horiz = FALSE, title = NULL, inset = 0,  xpd,
       title.col = text.col)

Es folgt eine Beschreibung der Argumente von legend() (viele davon lassen sich auch als Argumente an Funktionen übergeben, die Legenden einrichten können): ...

Get R in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.