Skip to content
Prev 69000 / 398513 Next

Lattice dotplot with symbols sized and colored

David Kidd wrote on 5/3/2005 3:08 AM:
Hi David,

I think you're on the right track using groups. However, you just have 
to set the trellis arguments correctly. For example,

library(lattice)
my.theme <- function() {
   theme <- col.whitebg()
   symb <- theme$superpose.symbol
   symb$cex <- seq(0.5, 1.5, length = length(symb$cex))
   # symb$pch is c(1, 3, 6, 0, 5, 16, 17) by default for col.whitebg
   theme$superpose.symbol <- symb
   theme
}
trellis.par.set(theme = my.theme())
# from ?dotplot
dotplot(variety ~ yield | year, data = barley, groups = site)

It's not necessary to create a theme. You can accomplish the same just 
using trellis.par.get and trellis.par.set. The above is just my personal 
preference.

HTH,

--sundar