For example:
mytheme <- trellis.par.get()
mytheme$strip.border$col = 'grey80'
mytheme$strip.background$col = 'grey80'
mytheme$axis.line$col = 'grey80'
mytheme$axis.text$col = 'grey60'
mytheme$plot.symbol$pch = 20
mytheme$plot.symbol$cex = .5
mytheme$plot.symbol$col = '#7AC5CD'
mytheme$plot.symbol$alpha = .8
l.sc <- update(scatter.lattice, par.settings = mytheme,
layout = c(3, 2),
between = list(x = 0.3, y = 0.3))
print(l.sc)
How can I set the default of par.settings
to be mytheme
?
In the book Lattice Multivariate Data Visualization with R , page 131, the author gives this example:
lattice.options(lattice.theme = standard.theme("pdf"))
But I don't see how to adapt it to the current case. I tried:
lattice.options(lattice.theme = mytheme)
and it doesn't work.
The theme can be set persistently (ie, they will affect all subsequent plots until a new setting is specified) using the trellis.par.set()
function:
trellis.par.set(mytheme) ## mythme is a named list with settings parameters
where mytheme is a list( no need to call trellis.par.get()):
mytheme <- list()
mytheme$strip.border$col = 'grey80'
mytheme$strip.background$col = 'grey80'
mytheme$axis.line$col = 'grey80'
mytheme$axis.text$col = 'grey60'
mytheme$plot.symbol$pch = 20
mytheme$plot.symbol$cex = .5
mytheme$plot.symbol$col = '#7AC5CD'
mytheme$plot.symbol$alpha = .8
To set the theme temporarily , you set the "par.settings" argument of the lattice plotting function. For example this is how latticeExtra
set the ggplot2 like theme:
library(latticeExtra)
xyplot(exp(1:10) ~ 1:10, type = "b",
par.settings = ggplot2like())
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.