R: how to change lattice (levelplot) color theme?

user442446 picture user442446 · Sep 14, 2010 · Viewed 29.7k times · Source

The default theme on my installation is something which maps the values to pink and cyan. How to change it for example to a gray scale theme?

Answer

Dirk Eddelbuettel picture Dirk Eddelbuettel · Sep 14, 2010

You can use

library(lattice)
lattice.options(default.theme = standard.theme(color = FALSE))

which turns on black-and-white suitable for printing. I've also played with things like

sb <- trellis.par.get("strip.background") 
sb[["col"]][1] <- "lightgray"
trellis.par.set("strip.background", sb) 

which changes just the header background.

And I thought people only asked ggplot2 questions here :) Nice to see some lattice for a change.