Meesters, Erik <Erik.Meesters <at> wur.nl> writes:
> is there a way to define the color of the title for the legend in
> lattice?
Getting the right par to set in lattice can be intimidating. I keep the result
of trellis.par.get() in a text file and search for the "closest
match".
Dieter
library(lattice)
show.settings() # does not help much here (wish this were more complete..)
# capture the following output into a text file
trellis.par.get()
# end of trying around, let's work
# you need to know that the title called "main"
pars = trellis.par.get("par.main.text")
pars$col="red"
trellis.par.set("par.main.text",pars)
xyplot(rnorm(100)~rnorm(100),main="Hello")
# I normally use the following method to set many of my pars at once
"DMlatticeOptions" <- function(superpose.polygon.col=NULL,
superpose.line.col=NULL) {
require(lattice)
require(RColorBrewer)
ltheme = canonical.theme(color=TRUE)
if (!is.null(superpose.polygon.col))
ltheme$superpose.line$col = superpose.line.col else
ltheme$superpose.line$col
c('black',"red","blue","#e31111","darkgreen",
"gray")
# ltheme$superpose.line$col = rev(brewer.pal(8,"Set1"))
ltheme$superpose.fill$col = ltheme$superpose.line$col
if (!is.null(superpose.polygon.col))
ltheme$superpose.polygon$col = superpose.polygon.col
ltheme$strip.shingle$col = ltheme$superpose.polygon$col
ltheme$superpose.symbol$pch = c(16,17,18,1,2,3,4,8)
ltheme$superpose.symbol$col = ltheme$superpose.line$col
ltheme$superpose.symbol$cex = 0.4
ltheme$strip.background$col = c("gray90", "gray80")
ltheme$background$col = "transparent"
ltheme$par.main.text$cex = 0.9 # default is 1.2
ltheme$par.ylab.text$cex =0.8
ltheme$par.ylab.text$cex =0.8
ltheme$add.text$cex = 1
ltheme$axis.text$cex = 0.6
ltheme$box.rectangle$col = "black"
ltheme$box.umbrella$col = "black"
ltheme$dot.symbol$col = "black"
ltheme$plot.symbol$col = "black"
ltheme$plot.line$col = "black"
ltheme$plot.symbol$cex = 0.3
ltheme$plot.symbol$pch = c(16)
ltheme$plot.polygon$col = "#A6D96A"
ltheme$par.sub.text$cex=0.7
ltheme$par.sub.text$font=1
lattice.options(default.theme=ltheme)
}