latticeStyleGUI: A plot style settings GUI

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/latticeStyleGUI.R

Description

A graphical user interface to edit the Lattice theme for a given device. It can also set some simple base graphics parameters.

Usage

1
2
3
4
latticeStyleGUI(width = 480, height = 480, pointsize = 12,
                target.device = dev.cur(), base.graphics = FALSE)

latticeStyleToBasePar()

Arguments

width, height

initial size in pixels of the embedded graphic device.

pointsize

pointsize for the embedded graphic device.

target.device

the device for which to edit style settings; defaults to the current device.

base.graphics

whether to apply settings to the base graphics parameters (par) as well as the lattice graphics parameters. This is quite limited compared to the lattice system: not all controls in the interface will have an effect. Also, base graphics plots may or may not use the par() settings.

Details

latticeStyleGUI() is an interface to trellis.par.get / trellis.par.set. It is not a comprehensive interface: some simplifications and omissions have been made from the full list of settings.

The graphical user interface is built on the gWidgets package. As such it can run under different GUI toolkits such as gWidgetsRGtk2, gWidgetstcltk, etc.

Changes take effect immediately. Load a new theme to reset. The embedded graphic device (or non-embedded, depending on the GUI toolkit) will show a preview of your settings. You can also plot on the target device while keeping the GUI open, for testing.

The GUI may be very slow to initialise. It is recommended to update to the latest version of the gWidgets package (and its toolkit implementations), as these include significant speed-ups.

latticeStyleToBasePar() attempts to apply the current lattice style settings to the base graphics system (par and palette). Only basic settings are used. See the function definition for details.

Value

latticeStyleGUI does not return anything, but does change graphical settings for the given device. It also creates an object trellis.par.theme in the global workspace containing the Lattice theme (i.e. list of settings). Another object trellis.par.log holds a subset of that: just the changes made from a built-in theme.

latticeStyleToBasePar returns the previous par settings.

Note

Plot calls can over-ride these settings, so there is no guarantee that the settings will be visible on a given plot.

Author(s)

Felix Andrews felix@nfrac.org

References

For an excellent introduction to and coverage of Lattice:

Sarkar, Deepayan (2008) "Lattice: Multivariate Data Visualization with R", Springer. http://lmdvr.r-forge.r-project.org/

See Also

trellis.par.get, par, latticeStyleDemo

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
if (interactive())
{
    latticeStyleGUI()
}

## a base graphics plot (from example(matplot))
sines <- outer(1:20, 1:4, function(x, y) sin(x / 20 * pi * y))
matplot(sines, pch = 1:4, type = "o")

## apply Lattice settings and re-plot
opar <- latticeStyleToBasePar()
matplot(sines, pch = 1:4, type = "o")

## apply a different Lattice theme
trellis.par.set(custom.theme.black())
latticeStyleToBasePar()
plot(Ozone ~ Wind, data = airquality, col = 1)

## reset:
par(opar)
palette("default")

11010tianyi/latticist documentation built on May 5, 2019, 10:36 a.m.