Using Lattice Graphics in R

This tutorial explores lattice or trellis graphics in R.

1. Introduction

The goal of data graphics is to communicate. R provides two sets of primitives that allow you to see and present data. This tutorial explores the more advanced trellis graphics capability.

2. Resources

3. The Use of Lattice or Trellis Graphics

Lattice graphics were developed by Deepayan Sarkar to implement ideas of Bill Cleveland in his 1993 book, Visualizing Data. Trellis graphics are used in S-Plus, while the Lattice library implements Trellis for R. Lattice is built on Paul Murrell's Grid Graphics engine.

High-level Lattice functions do not actually print or plot anything. They create an object of class "trellis", which can be printed or plotted.

Lattice graphics are very customisable, but par() settings have no effect.

3.1 Setting Up

Execute the following command:


  library(lattice)

For information on lattice, type:


  help(package = lattice)

The examples in this section are generally drawn from the R documentation and Murrell (2006).

For much more extensive information on Trellis Graphics, explore this site.

3.2 The Graphics Model

As noted, Lattice Graphics functions seem to work just like the traditional graphics; however, high-level Lattice functions do not actually print or plot anything. They create an object of class "trellis", which can be printed or plotted. This is done automatically if the high-level function is called directly, but not when it is called by source() or in for or while loops.

The following example is adapted from Murrell (2006) and makes use of the quakes database provided as part of R. Type:


 xyplot(lat~long, data=quakes, pch=".")

Decoding this command, the database is called quakes and incorporates a number of fields, including the latitude (lat) and longitude (long) of the individual quakes. The quakes are plotted at their locations using a small dot ("."). The locations are passed to xyplot using a formula (lat~long), with lat being the x coordinate and long the y coordinate. A scatterplot is generated (xyplot) and automatically printed.

You can also use the following commands to do the same thing:


 tplot<-xyplot(lat~long, data=quakes, pch=".")
 print(tplot)

and have a plot object (tplot) that can be amended further. The following command will add a main title and plot the resulting Trellis object:


 tplot2<-update(tplot,
     main="Earthquakes in the Pacific Ocean (since 1964)")
 print(tplot2)

which looks like this:

Murrell gives three reasons for using Lattice Graphics:

  1. They usually look better.
  2. They can be extended in powerful ways.
  3. The resulting output can be annotated, edited, and saved.

Consult the on-line help for details.

The first argument to the Lattice plotting functions is a formula. In the example, the formula is

     lat ~ long

If the plot takes a single vector, the formula can be written:

     ~ long

with the y vector being names(x) if it exists or a single level factor otherwise. If the plot is three dimensional, the formula needs to be in the form:

     z ~ x * y

The formula can include method calls like sqrt() or log() to transform individual dimensions. If the user wishes to plot two y columns (y1 and y2) against an x column, they need to write the formula as:

     y1 + y2 ~ x

For two x columns (x1 and x2) against the y column, it's:

     y ~ x1 + x2

(Note the difference from z ~ x * y.)

A plot can also be conditioned on one or more additional variables, g1, g2, etc. Then the formula is written:

     y ~ x | g1 + g2 +...

Alternatively, the formula can be written (except for xyplot()):

     y ~ x | g1 * g2 *...

Since this formula has a special meaning for xyplot(), it's probably best to avoid. The conditioning variables, g1, g2, etc., can be either factors or 'shingles'. A shingle is a generalization of factor to 'continuous' variables. The R documentation goes into this, but to summarise, a shingle is a numeric vector along with some possibly overlapping intervals. These intervals are the 'levels' of the shingle. You can create a shingle using shingle(x,intervals) or equal.count(x,...), the latter dividing x up into a series of intervals with equal counts. The number of intervals is defined by an argument number. You can plot() or print() a shingle.

The second argument to a Lattice plot method is usually data, specifying the data frame to use.

Murrell discusses conditioning in some depth, as a very powerful capability. Rather than taking time here, see the book. The following code generates a rather elegant summary of the earthquake data.


 depthgroup<-equal.count(quakes$depth, number=3, overlap=0)
 magnitude<-equal.count(quakes$mag, number=2, overlap=0)
 xyplot(lat ~ long | depthgroup*magnitude,
 data=quakes,
 main="Fiji Earthquakes",
 ylab="latitude", xlab="longitude",
 pch=".",
 scales=list(x=list(alternating=c(1,1,1))),
 between=list(y=1),
 par.strip.text=list(cex=0.7),
 par.settings=list(axis.text=list(cex=0.7)))

producing the following image:

3.3 Simple Plots

These give examples of each plot (from the R documentation) and the commands to generate them. Use the help() function for details.

3.3.1 barchart

Bar plots. These look like the following:


 barchart(yield ~ variety | site, data = barley,
         groups = year, layout = c(1,6),
         ylab = "Barley Yield (bushels/acre)",
         scales = list(x = list(abbreviate = TRUE,
                       minlength = 5)))

or


 barchart(yield ~ variety | site, data = barley,
         groups = year, layout = c(1,6), stack = TRUE, 
         auto.key = list(points = FALSE, rectangles = TRUE, space = "right"),
         ylab = "Barley Yield (bushels/acre)",
         scales = list(x = list(rot = 45)))

3.3.2 bwplot

Box and whisker plots.


 bwplot(voice.part ~ height, data=singer, xlab="Height (inches)")

3.3.3 densityplot

Kernel density plots. These are related to histograms--being used to show a one-dimensional distribution of values--with a kernel density curve superimposed as an estimate of the true distribution. The default kernel is a 'bell-shaped curve' (gaussian), but other functions are possible, including epanechnikov, rectangular, triangular, biweight, cosine, and optcosine.


  densityplot( ~ height | voice.part, data = singer, layout = c(2, 4),  
            xlab = "Height (inches)", bw = 5)

3.3.4 dotplot

Dot plots. These show one-dimensional measurements organised by factor. The following plots need to be shown on a fairly large image to be legible. (In R, you can resize the image window. Here it is resized to 720x720.)


 dotplot(variety ~ yield | year * site, data=barley)


 dotplot(variety ~ yield | site, data = barley, groups = year,
        key = simpleKey(levels(barley$year), space = "right"),
        xlab = "Barley Yield (bushels/acre) ",
        aspect=0.5, layout = c(1,6), ylab=NULL)

3.3.5 histogram

Histograms show a one-dimensional distribution of values, giving the number of values per measurement bin. One neuroscience application is the post-stimulus time distribution of action potentials.


 histogram( ~ height | voice.part, data = singer, nint = 17,
          endpoints = c(59.5, 76.5), layout = c(2,4), aspect = 1,
          xlab = "Height (inches)")

The following shows a superimposed density (similar to kernel density plots in 3.3.3).


 histogram( ~ height | voice.part, data = singer,
          xlab = "Height (inches)", type = "density",
          panel = function(x, ...) {
              panel.histogram(x, ...)
              panel.mathdensity(dmath = dnorm, col = "black",
                                args = list(mean=mean(x),sd=sd(x)))
          } )

3.3.6 qqmath

Quantile-quantile plot of a sample against a mathematical distribution. Here are three examples. First a comparison of a gaussian distribution generated using a random number generator with that generated by theory. This illustrates the usual variation in gaussian distributions.


 qqmath(~ rnorm(100), distribution = function(p) qt(p, df = 10))

Now a comparison of the singer height data with theory.


qqmath(~ height | voice.part, aspect = "xy", data = singer,
       prepanel = prepanel.qqmathline,
       panel = function(x, ...) {
          panel.qqmathline(x, ...)
          panel.qqmath(x, ...)
       })

Finally, combining both groups of singers in each category.


vp.comb <-
    factor(sapply(strsplit(as.character(singer$voice.part), split = " "),
                  "[", 1),
           levels = c("Bass", "Tenor", "Alto", "Soprano"))
vp.group <-
    factor(sapply(strsplit(as.character(singer$voice.part), split = " "),
                  "[", 2))
qqmath(~ height | vp.comb, data = singer,
       groups = vp.group, auto.key = list(space = "right"),
       aspect = "xy",
       prepanel = prepanel.qqmathline,
       panel = function(x, ...) {
          panel.qqmathline(x, ...)
          panel.qqmath(x, ...)
       })

3.3.7 stripplot

One-dimensional scatterplots--an alternative to a histogram. This example is using the singer data. Jitter is set to true so that all the points are visible.


 stripplot(voice.part ~ jitter(height), data = singer, aspect = 1,
          jitter = TRUE, xlab = "Height (inches)")

3.4 Multiple Variables

3.4.1 qq

Quantile-quantile plots for comparing two distributions. This chart compares the upper half of the tenors with the lower half of the basses.


 qq(voice.part ~ height, aspect = 1, data = singer,
   subset = (voice.part == "Bass 2" | voice.part == "Tenor 1"))

3.4.2 xyplot

Scatter plots (powerful). Several examples from the R documentation.


 EE <- equal.count(ethanol$E, number=9, overlap=1/4)
## Constructing panel functions on the fly; prepanel
xyplot(NOx ~ C | EE, data = ethanol,
       prepanel = function(x, y) prepanel.loess(x, y, span = 1),
       xlab = "Compression Ratio", ylab = "NOx (micrograms/J)",
       panel = function(x, y) {
           panel.grid(h=-1, v= 2)
           panel.xyplot(x, y)
           panel.loess(x,y, span=1)
       },
       aspect = "xy")




## with and without banking

plot <- xyplot(sunspot.year ~ 1700:1988, xlab = "", type = "l",
               scales = list(x = list(alternating = 2)),
               main = "Yearly Sunspots")
print(plot, position = c(0, .3, 1, .9), more = TRUE)
print(update(plot, aspect = "xy", main = "", xlab = "Year"),
      position = c(0, 0, 1, .3))





## Multiple variables in formula for grouped displays

xyplot(Sepal.Length + Sepal.Width ~ Petal.Length + Petal.Width | Species, 
       data = iris, scales = "free", layout = c(2, 2),
       auto.key = list(x = .6, y = .7, corner = c(0, 0)))



## user defined panel functions

states <- data.frame(state.x77,
                     state.name = dimnames(state.x77)[[1]], 
                     state.region = state.region) 
xyplot(Murder ~ Population | state.region, data = states, 
       groups = state.name, 
       panel = function(x, y, subscripts, groups)  
       ltext(x = x, y = y, label = groups[subscripts], cex=1,
             fontfamily = "HersheySans"))


## Interaction Plot

xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos,
       type = "a",
       auto.key =
       list(space = "right", points = FALSE, lines = TRUE))

3.4.3 levelplot

Level or image plots.


 x <- seq(pi/4, 5 * pi, length = 100)
y <- seq(pi/4, 5 * pi, length = 100)
r <- as.vector(sqrt(outer(x^2, y^2, "+")))
grid <- expand.grid(x=x, y=y)
grid$z <- cos(r^2) * exp(-r/(pi^3))
levelplot(z~x*y, grid, cuts = 50, scales=list(log="e"), xlab="",
          ylab="", main="Weird Function", sub="with log scales",
          colorkey = FALSE, region = TRUE)

3.4.4 contourplot

Contour plots.


 attach(environmental)
ozo.m <- loess((ozone^(1/3)) ~ wind * temperature * radiation,
       parametric = c("radiation", "wind"), span = 1, degree = 2)
w.marginal <- seq(min(wind), max(wind), length = 50)
t.marginal <- seq(min(temperature), max(temperature), length = 50)
r.marginal <- seq(min(radiation), max(radiation), length = 4)
wtr.marginal <- list(wind = w.marginal, temperature = t.marginal,
        radiation = r.marginal)
grid <- expand.grid(wtr.marginal)
grid[, "fit"] <- c(predict(ozo.m, grid))
contourplot(fit ~ wind * temperature | radiation, data = grid,
            cuts = 10, region = TRUE,
            xlab = "Wind Speed (mph)",
            ylab = "Temperature (F)",
            main = "Cube Root Ozone (cube root ppb)")
detach()

3.4.5 cloud

Three-dimensional scatter plots. There's a lot more power--look at the documentation.


 cloud(Sepal.Length ~ Petal.Length * Petal.Width | Species, data = iris,
      screen = list(x = -90, y = 70), distance = .4, zoom = .6)

3.4.6 wireframe

Three-dimensional surfaces (similar to persp). This one is rather nice.


 ## volcano  ## 87 x 61 matrix
wireframe(volcano, shade = TRUE,
          aspect = c(61/87, 0.4),
          light.source = c(10,0,10))

3.4.7 splom

Scatterplot matrix (similar to pairs).


 super.sym <- trellis.par.get("superpose.symbol")
splom(~iris[1:4], groups = Species, data = iris,
      panel = panel.superpose,
      key = list(title = "Three Varieties of Iris",
                 columns = 3, 
                 points = list(pch = super.sym$pch[1:3],
                 col = super.sym$col[1:3]),
                 text = list(c("Setosa", "Versicolor", "Virginica"))))
                 


 splom(~iris[1:3]|Species, data = iris, 
      layout=c(2,2), pscales = 0,
      varnames = c("Sepal\nLength", "Sepal\nWidth", "Petal\nLength"),
      page = function(...) {
          ltext(x = seq(.6, .8, len = 4), 
                y = seq(.9, .6, len = 4), 
                lab = c("Three", "Varieties", "of", "Iris"),
                cex = 2)
      })

3.4.8 parallel

Parallel coordinate plots. These are related to splom plots and are fairly specialised.


 parallel(~iris[1:4] | Species, iris)

3.5 Specialised Plots

3.5.1 rfs

Residual and fitted value plot. This is used for diagnosis of statistical problems.


 rfs(oneway(height ~ voice.part, data = singer, spread = 1), aspect = 1)

3.5.2 tmd

Tukey Mean-Difference plot. Another diagnostic plot.


 tmd(qqmath(~height | voice.part, data = singer))

3.6 Customisation

The appearance of Lattice plots can be customised by setting various parameters. The function show.settings() produces a picture showing some of the current parameter settings. Here's an example of what it displays:

The current value can be obtained using trellis.par.get(). This is the output for the device for which the settings were shown:


 $grid.pars
list()

$fontsize
$fontsize$text
[1] 12

$fontsize$points
[1] 8


$background
$background$alpha
[1] 1

$background$col
[1] "transparent"


$clip
$clip$panel
[1] "on"

$clip$strip
[1] "on"


$add.line
$add.line$alpha
[1] 1

$add.line$col
[1] "#000000"

$add.line$lty
[1] 1

$add.line$lwd
[1] 1


$add.text
$add.text$alpha
[1] 1

$add.text$cex
[1] 1

$add.text$col
[1] "#000000"

$add.text$font
[1] 1

$add.text$lineheight
[1] 1.2


$plot.polygon
$plot.polygon$alpha
[1] 1

$plot.polygon$col
[1] "#00ffff"

$plot.polygon$border
[1] "black"

$plot.polygon$lty
[1] 1

$plot.polygon$lwd
[1] 1


$box.dot
$box.dot$alpha
[1] 1

$box.dot$col
[1] "#000000"

$box.dot$cex
[1] 1

$box.dot$font
[1] 1

$box.dot$pch
[1] 16


$box.rectangle
$box.rectangle$alpha
[1] 1

$box.rectangle$col
[1] "#0080ff"

$box.rectangle$fill
[1] "transparent"

$box.rectangle$lty
[1] 1

$box.rectangle$lwd
[1] 1


$box.umbrella
$box.umbrella$alpha
[1] 1

$box.umbrella$col
[1] "#0080ff"

$box.umbrella$lty
[1] 2

$box.umbrella$lwd
[1] 1


$dot.line
$dot.line$alpha
[1] 1

$dot.line$col
[1] "#e6e6e6"

$dot.line$lty
[1] 1

$dot.line$lwd
[1] 1


$dot.symbol
$dot.symbol$alpha
[1] 1

$dot.symbol$cex
[1] 0.8

$dot.symbol$col
[1] "#0080ff"

$dot.symbol$font
[1] 1

$dot.symbol$pch
[1] 16


$plot.line
$plot.line$alpha
[1] 1

$plot.line$col
[1] "#0080ff"

$plot.line$lty
[1] 1

$plot.line$lwd
[1] 1


$plot.symbol
$plot.symbol$alpha
[1] 1

$plot.symbol$cex
[1] 0.8

$plot.symbol$col
[1] "#0080ff"

$plot.symbol$font
[1] 1

$plot.symbol$pch
[1] 1

$plot.symbol$fill
[1] "transparent"


$reference.line
$reference.line$alpha
[1] 1

$reference.line$col
[1] "#e6e6e6"

$reference.line$lty
[1] 1

$reference.line$lwd
[1] 1


$strip.background
$strip.background$alpha
[1] 1

$strip.background$col
[1] "#ffe5cc" "#ccffcc" "#ccffff" "#cce6ff" "#ffccff" "#ffcccc" "#ffffcc"


$strip.shingle
$strip.shingle$alpha
[1] 1

$strip.shingle$col
[1] "#ff7f00" "#00ff00" "#00ffff" "#0080ff" "#ff00ff" "#ff0000" "#ffff00"


$strip.border
$strip.border$alpha
[1] 1

$strip.border$col
[1] "#000000" "#000000" "#000000" "#000000" "#000000" "#000000" "#000000"

$strip.border$lty
[1] 1 1 1 1 1 1 1

$strip.border$lwd
[1] 1 1 1 1 1 1 1


$superpose.line
$superpose.line$alpha
[1] 1

$superpose.line$col
[1] "#0080ff"   "#ff00ff"   "darkgreen" "#ff0000"   "orange"   
[6] "#00ff00"   "brown"    

$superpose.line$lty
[1] 1 1 1 1 1 1 1

$superpose.line$lwd
[1] 1 1 1 1 1 1 1


$superpose.symbol
$superpose.symbol$alpha
[1] 1 1 1 1 1 1 1

$superpose.symbol$cex
[1] 0.8 0.8 0.8 0.8 0.8 0.8 0.8

$superpose.symbol$col
[1] "#0080ff"   "#ff00ff"   "darkgreen" "#ff0000"   "orange"   
[6] "#00ff00"   "brown"    

$superpose.symbol$font
[1] 1 1 1 1 1 1 1

$superpose.symbol$pch
[1] 1 1 1 1 1 1 1

$superpose.symbol$fill
[1] "transparent" "transparent" "transparent" "transparent" "transparent"
[6] "transparent" "transparent"


$superpose.polygon
$superpose.polygon$alpha
[1] 1 1 1 1 1 1 1

$superpose.polygon$col
[1] "#00ffff" "#ff00ff" "#00ff00" "#ff7f00" "#0080ff" "#ffff00" "#ff0000"

$superpose.polygon$border
[1] "black" "black" "black" "black" "black" "black" "black"

$superpose.polygon$lty
[1] 1 1 1 1 1 1 1

$superpose.polygon$lwd
[1] 1 1 1 1 1 1 1


$regions
$regions$alpha
[1] 1

$regions$col
  [1] "#FF80FFFF" "#FF82FFFF" "#FF85FFFF" "#FF87FFFF" "#FF8AFFFF"
  [6] "#FF8CFFFF" "#FF8FFFFF" "#FF91FFFF" "#FF94FFFF" "#FF96FFFF"
 [11] "#FF99FFFF" "#FF9CFFFF" "#FF9EFFFF" "#FFA1FFFF" "#FFA3FFFF"
 [16] "#FFA6FFFF" "#FFA8FFFF" "#FFABFFFF" "#FFADFFFF" "#FFB0FFFF"
 [21] "#FFB3FFFF" "#FFB5FFFF" "#FFB8FFFF" "#FFBAFFFF" "#FFBDFFFF"
 [26] "#FFBFFFFF" "#FFC2FFFF" "#FFC4FFFF" "#FFC7FFFF" "#FFC9FFFF"
 [31] "#FFCCFFFF" "#FFCFFFFF" "#FFD1FFFF" "#FFD4FFFF" "#FFD6FFFF"
 [36] "#FFD9FFFF" "#FFDBFFFF" "#FFDEFFFF" "#FFE0FFFF" "#FFE3FFFF"
 [41] "#FFE6FFFF" "#FFE8FFFF" "#FFEBFFFF" "#FFEDFFFF" "#FFF0FFFF"
 [46] "#FFF2FFFF" "#FFF5FFFF" "#FFF7FFFF" "#FFFAFFFF" "#FFFCFFFF"
 [51] "#FCFFFFFF" "#FAFFFFFF" "#F7FFFFFF" "#F5FFFFFF" "#F2FFFFFF"
 [56] "#F0FFFFFF" "#EDFFFFFF" "#EBFFFFFF" "#E8FFFFFF" "#E6FFFFFF"
 [61] "#E3FFFFFF" "#E0FFFFFF" "#DEFFFFFF" "#DBFFFFFF" "#D9FFFFFF"
 [66] "#D6FFFFFF" "#D4FFFFFF" "#D1FFFFFF" "#CFFFFFFF" "#CCFFFFFF"
 [71] "#C9FFFFFF" "#C7FFFFFF" "#C4FFFFFF" "#C2FFFFFF" "#BFFFFFFF"
 [76] "#BDFFFFFF" "#BAFFFFFF" "#B8FFFFFF" "#B5FFFFFF" "#B3FFFFFF"
 [81] "#B0FFFFFF" "#ADFFFFFF" "#ABFFFFFF" "#A8FFFFFF" "#A6FFFFFF"
 [86] "#A3FFFFFF" "#A1FFFFFF" "#9EFFFFFF" "#9CFFFFFF" "#99FFFFFF"
 [91] "#96FFFFFF" "#94FFFFFF" "#91FFFFFF" "#8FFFFFFF" "#8CFFFFFF"
 [96] "#8AFFFFFF" "#87FFFFFF" "#85FFFFFF" "#82FFFFFF" "#80FFFFFF"


$shade.colors
$shade.colors$alpha
[1] 1

$shade.colors$palette
function (irr, ref, height, saturation = 0.9) 
{
    hsv(h = height, s = 1 - saturation * (1 - (1 - ref)^0.5), 
        v = irr)
}


$axis.line
$axis.line$alpha
[1] 1

$axis.line$col
[1] "#000000"

$axis.line$lty
[1] 1

$axis.line$lwd
[1] 1


$axis.text
$axis.text$alpha
[1] 1

$axis.text$cex
[1] 0.8

$axis.text$col
[1] "#000000"

$axis.text$font
[1] 1


$axis.components
$axis.components$left
$axis.components$left$tck
[1] 1

$axis.components$left$pad1
[1] 1

$axis.components$left$pad2
[1] 1


$axis.components$top
$axis.components$top$tck
[1] 1

$axis.components$top$pad1
[1] 1

$axis.components$top$pad2
[1] 1


$axis.components$right
$axis.components$right$tck
[1] 1

$axis.components$right$pad1
[1] 1

$axis.components$right$pad2
[1] 1


$axis.components$bottom
$axis.components$bottom$tck
[1] 1

$axis.components$bottom$pad1
[1] 1

$axis.components$bottom$pad2
[1] 1



$layout.heights
$layout.heights$top.padding
[1] 1

$layout.heights$main
[1] 1

$layout.heights$main.key.padding
[1] 1

$layout.heights$key.top
[1] 1

$layout.heights$key.axis.padding
[1] 1

$layout.heights$axis.top
[1] 1

$layout.heights$strip
[1] 1

$layout.heights$panel
[1] 1

$layout.heights$axis.panel
[1] 1

$layout.heights$between
[1] 1

$layout.heights$axis.bottom
[1] 1

$layout.heights$axis.xlab.padding
[1] 1

$layout.heights$xlab
[1] 1

$layout.heights$xlab.key.padding
[1] 1

$layout.heights$key.bottom
[1] 1

$layout.heights$key.sub.padding
[1] 1

$layout.heights$sub
[1] 1

$layout.heights$bottom.padding
[1] 1


$layout.widths
$layout.widths$left.padding
[1] 1

$layout.widths$key.left
[1] 1

$layout.widths$key.ylab.padding
[1] 1

$layout.widths$ylab
[1] 1

$layout.widths$ylab.axis.padding
[1] 1

$layout.widths$axis.left
[1] 1

$layout.widths$axis.panel
[1] 1

$layout.widths$strip.left
[1] 1

$layout.widths$panel
[1] 1

$layout.widths$between
[1] 1

$layout.widths$axis.right
[1] 1

$layout.widths$axis.key.padding
[1] 1

$layout.widths$key.right
[1] 1

$layout.widths$right.padding
[1] 1


$box.3d
$box.3d$alpha
[1] 1

$box.3d$col
[1] "#000000"

$box.3d$lty
[1] 1

$box.3d$lwd
[1] 1


$par.xlab.text
$par.xlab.text$alpha
[1] 1

$par.xlab.text$cex
[1] 1

$par.xlab.text$col
[1] "#000000"

$par.xlab.text$font
[1] 1

$par.xlab.text$lineheight
[1] 1


$par.ylab.text
$par.ylab.text$alpha
[1] 1

$par.ylab.text$cex
[1] 1

$par.ylab.text$col
[1] "#000000"

$par.ylab.text$font
[1] 1

$par.ylab.text$lineheight
[1] 1


$par.zlab.text
$par.zlab.text$alpha
[1] 1

$par.zlab.text$cex
[1] 1

$par.zlab.text$col
[1] "#000000"

$par.zlab.text$font
[1] 1

$par.zlab.text$lineheight
[1] 1


$par.main.text
$par.main.text$alpha
[1] 1

$par.main.text$cex
[1] 1.2

$par.main.text$col
[1] "#000000"

$par.main.text$font
[1] 2

$par.main.text$lineheight
[1] 1


$par.sub.text
$par.sub.text$alpha
[1] 1

$par.sub.text$cex
[1] 1

$par.sub.text$col
[1] "#000000"

$par.sub.text$font
[1] 2

$par.sub.text$lineheight
[1] 1

To show an individual setting, type trellis.par.get("setting name"). To set a parameter so it applies to a series of graphics, type trellis.par.set("parameter",list(field1=value1, field2=value2, ...))) or trellis.par.set(list(parameter=list(field1=value1, field2=value2, ...))).

To set a parameter for an individual graphic, include it as an argument. There are a number of examples of this above in sections 3.2-3.5. My personal inclination is usually to accept the defaults. For help, type help(trellis.par.get).

3.7 Cleaning Up

If you have attached any data sets, detach them, or simply don't save the workspace when you quit.