R Under development (unstable) (2023-10-21 r85382 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > library(lattice) > > pdf("auto-key.pdf", width = 10, height = 7) > > d <- data.frame(x = rnorm(100), + y = rnorm(100), + a = gl(2, 50), + b = gl(7, 1, 50)) > > xyplot(y ~ x | a, data = d, groups = b, type = "p", auto.key = TRUE) > > xyplot(y ~ x | a, data = d, groups = b, type = "l", auto.key = TRUE) > > xyplot(y ~ x | a, data = d, groups = b, type = "o", auto.key = TRUE) > > cloud(y ~ x + a, data = d, groups = b, type = "b", auto.key = TRUE) > > splom(~ data.frame(x, y, z = x + y) | a, data = d, groups = b, + type = "b", auto.key = TRUE) > > densityplot(~ x, data = d, groups = b, auto.key = TRUE) > > histogram(~ x, data = d, groups = b, auto.key = TRUE) > > qqmath( ~ x | a, data = d, groups = b, type = "o", auto.key = TRUE) > > barchart(xtabs(x ~ a + b, data = d), auto.key = TRUE) > > ## not-default placements > > xyplot(y ~ x | a, data = d, groups = b, type = "o", + auto.key = list(space = "left", columns = 2)) > > xyplot(y ~ x | a, data = d, groups = b, type = "o", + auto.key = list(columns = 3)) > > p1 <- xyplot(y ~ x | a, data = d, groups = b, type = "o", + par.settings = simpleTheme(pch = 16)) > p2 <- dotplot(xtabs(x ~ b + a, data = d), + par.settings = simpleTheme(pch = 16)) > p3 <- barchart(xtabs(x ~ b + a, data = d), + par.settings = simpleTheme(pch = 16)) > > p1 > update(p1, auto.key = list(columns = 3)) > > p2 > update(p2, auto.key = list(columns = 2)) > > p3 > update(p3, auto.key = list(columns = 2)) > > dev.off() null device 1 > > > proc.time() user system elapsed 1.20 0.09 1.28