Question

With the key argument of lattice, I can set the size of the symbols in the key. I could not find a solution to do the same with auto.key (which has many advantages compared to key). Passing a list to points raises a "not logical" error.

library(lattice)
# Works to set symbol size, but needs additional work to give text etc.
xyplot(Sepal.Length + Sepal.Width ~ Petal.Length + Petal.Width | Species,
   data = iris, scales = "free", layout = c(2, 2),
   key = list(points=list(cex=2.5,pch=c(13,3,16)),x = .6, y = .7, corner = c(0, 0)))
# Fails
xyplot(Sepal.Length + Sepal.Width ~ Petal.Length + Petal.Width | Species,
   data = iris, scales = "free", layout = c(2, 2),
   auto.key = list(points=list(cex=2.5,pch=c(13,3,16)),
      x = .6, y = .7, corner = c(0, 0)))
Was it helpful?

Solution

See if this give you options (adapted from a suggestion by Sarkar regarding auto.key). The default cex of 3 set by simpleTheme is being modified so the plotted points are cex=1, but the default value carries forward into thane auto.key that looks like yours (except for the colors which I thought looked better, but tastes will vary):

xyplot(Sepal.Length + Sepal.Width ~ Petal.Length + Petal.Width | Species,
                   data = iris, scales = "free", layout = c(2, 2), cex=1,
        par.settings = simpleTheme(col=c("blue","red"),
                                   pch=c(13,3,16), cex=3, lwd=2),
        auto.key = list(points=TRUE,text=c("","",""),
                        x = .6, y = .7, corner = c(0, 0)) )
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top