Advertisement
celestialgod

lattice with additional legend

May 13th, 2015
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.61 KB | None | 0 0
  1. library(lattice)
  2. library(latticeExtra)
  3. library(grid)
  4. xyplot(Sepal.Width ~ Sepal.Length, groups = Species, data = iris, cex = 1.5,
  5.   key = list(space = "top", columns = 3, text = list(levels(iris$Species)),
  6.     points = list(cex = 1.5, pch=16,col=ggplot2like(n = 3)$superpose.symbol$col)),
  7.   par.settings = ggplot2like(n = 3),
  8.   lattice.options = ggplot2like.opts()) +
  9.   layer(panel.abline(a = -0.2,b = 0.7, col=1, lwd=2)) +
  10.   layer(panel.abline(a = -0.3,b = 0.6, col=2, lwd=2))
  11.   draw.key(list(columns = 2, text = list(paste("Line", 1:2)),
  12.     lines = list(lwd=2,col=1:2)), draw = TRUE, vp = viewport(.5, .93))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement