Controlling graphics parameters in lattice
On Fri, 6 Dec 2002, Michael Friendly wrote:
I'm just starting to work with lattice graphics, and am having difficulty understanding how to control various graphic parameters (font sizes, etc.). [I'm actually using xyplot via plot.effect() in the car package, and would like to be able to set some global defaults.] I read ?xyplot and ?trellis.par.set-- which contains no complete list of parameters, just a reference to print(trellis.par.get())
print(trellis.par.get())
$fontsize $fontsize$default [1] 10 I tried
trellis.par.set("fontsize", 12)
data(quakes)
Depth <- equal.count(quakes$depth, number=8, overlap=.1)
xyplot(lat ~ long | Depth, data = quakes)
And this crashes the Rgui (Windows, R 1.6.1). Is this a buglet or did I do something wrong?
Both. Try
trellis.par.set("fontsize", list(default=12))
but it is a bug in the grid package.
As well, I'm confused about why the following has no effect on the background (from a fresh start):
library(lattice)
You need to open the device whose background you are trying to change: trellis.device()
trellis.par.set("background", "white")
data(quakes)
Depth <- equal.count(quakes$depth, number=8, overlap=.1)
xyplot(lat ~ long | Depth, data = quakes)
Only after I've run xyplot once, I can repeat
trellis.par.set("background", "white")
xyplot(lat ~ long | Depth, data = quakes)
and the background will change.
That should be detected (no trellis device open) and give an error or open a device.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595