Learn R Programming

rapport (version 0.31)

decorate.lattice: Decorating lattice plots

Description

Apply required theme and grid options to called lattice/trellis plot.

Usage

decorate.lattice(expr, theme = getOption("style.theme"),
    grid = getOption("style.grid"))

Arguments

expr
call to lattice which will be evaluated with added theme options
theme
name of theme to use. Besides theme.rapport there are several themes available in other packages too, eg. standard.theme() from lattice, gplot2like() and theEco
grid
show grid in the background? It is possible to render a grid for 'both', only for 'x' or solely to 'y' axis. 'none' results in a blank background.

Value

  • lattice/trellis object

Details

Default parameters are read from options:

  • 'style.theme',
  • 'style.grid'.

Examples

Run this code
decorate.lattice(histogram(mtcars$hp))
decorate.lattice(histogram(mtcars$hp), grid='y')
decorate.lattice(histogram(mtcars$hp), grid='both')
decorate.lattice(histogram(mtcars$hp), theme="theme.rapport(bw = TRUE)")
decorate.lattice(histogram(mtcars$hp, type = "density", panel = function(x, ...) {
  panel.histogram(x, ...)
  panel.densityplot(x, darg=list(na.rm=TRUE), ...)
}))
decorate.lattice(bwplot(decrease ~ treatment, OrchardSprays, groups = rowpos), grid='none')
decorate.lattice(bwplot(decrease ~ treatment, OrchardSprays, groups = rowpos), grid='y')
decorate.lattice(bwplot(voice.part ~ height, data = singer), grid='x')
decorate.lattice(bwplot(voice.part ~ height, data = singer), grid='x', theme="theme.rapport(bw = TRUE)")
decorate.lattice(barchart(VADeaths))
decorate.lattice(barchart(VADeaths), theme="theme.rapport(palette='Greens')", grid='x')
decorate.lattice(barchart(VADeaths), theme="theme.rapport(bw = TRUE)", grid='x')
decorate.lattice(barchart(VADeaths), theme="theme.rapport(font = 'Garamond')", grid='x')
decorate.lattice(barchart(VADeaths), theme="ggplot2like", grid='x')
decorate.lattice(barchart(VADeaths), theme="theEconomist.theme", grid='x')
decorate.lattice(barchart(VADeaths, main='TITLE (70-74)'), theme="theme.rapport(custom = list(axis.text = list(fontfamily='Garamond')))", grid='x')

Run the code above in your browser using DataLab