[R] Lattice key title color and trellis par settings
Meesters, Erik
Erik.Meesters at wur.nl
Fri Oct 17 08:28:05 CEST 2008
Thank you all! This is a great course on Lattice par settings (though
not answering the question)!
And a truly must have: Lattice: Multivariate Data Visualization with R
(Use R).
Thank you Dr. Sarkar!
Here's it all summed up.
#Looking at lattice par settings:
library(lattice)
str(trellis.par.get())
# From Deepayan Sarkar
http://lmdvr.r-forge.r-project.org/figures/figures.html?chapter=07;figur
e=07_03
#page(draw.key) reveals the following snippet:
#
# if (!is.null(key$title))
# key.gf <- placeGrob(key.gf, textGrob(label = key$title,
# gp = gpar(cex = key$cex.title, lineheight =
key$lineheight)),
# row = 1, col = NULL)
#
#So, the title color cannot be currently specified, either directly or
through the settings system.
#From Greg Snow
library(TeachingDemos)
TkListView(trellis.par.get())
#From Dieter Menne:
# 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)
}
More information about the R-help
mailing list