Description Usage Arguments Details Value Author(s) References See Also Examples
Draws false color level plots and contour plots.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73  levelplot(x, data, ...)
contourplot(x, data, ...)
## S3 method for class 'formula'
levelplot(x,
data,
allow.multiple = is.null(groups)  outer,
outer = TRUE,
aspect = "fill",
panel = if (useRaster) lattice.getOption("panel.levelplot.raster")
else lattice.getOption("panel.levelplot"),
prepanel = NULL,
scales = list(),
strip = TRUE,
groups = NULL,
xlab,
xlim,
ylab,
ylim,
at,
cuts = 15,
pretty = FALSE,
region = TRUE,
drop.unused.levels =
lattice.getOption("drop.unused.levels"),
...,
useRaster = FALSE,
lattice.options = NULL,
default.scales = list(),
default.prepanel =
lattice.getOption("prepanel.default.levelplot"),
colorkey = region,
col.regions,
alpha.regions,
subset = TRUE)
## S3 method for class 'formula'
contourplot(x,
data,
panel = lattice.getOption("panel.contourplot"),
default.prepanel =
lattice.getOption("prepanel.default.contourplot"),
cuts = 7,
labels = TRUE,
contour = TRUE,
pretty = TRUE,
region = FALSE,
...)
## S3 method for class 'table'
levelplot(x, data = NULL, aspect = "iso", ..., xlim, ylim)
## S3 method for class 'table'
contourplot(x, data = NULL, aspect = "iso", ..., xlim, ylim)
## S3 method for class 'matrix'
levelplot(x, data = NULL, aspect = "iso",
..., xlim, ylim,
row.values = seq_len(nrow(x)),
column.values = seq_len(ncol(x)))
## S3 method for class 'matrix'
contourplot(x, data = NULL, aspect = "iso",
..., xlim, ylim,
row.values = seq_len(nrow(x)),
column.values = seq_len(ncol(x)))
## S3 method for class 'array'
levelplot(x, data = NULL, ...)
## S3 method for class 'array'
contourplot(x, data = NULL, ...)

x 
for the Calculations are based on the assumption that all x and y values are evaluated on a grid (defined by their unique values). The function will not return an error if this is not true, but the display might not be meaningful. However, the x and y values need not be equally spaced. Both 
data 
For the 
row.values, column.values 
Optional vectors of values that
define the grid when 
panel 
panel function used to create the display, as described in

aspect 
For the 
at 
A numeric vector giving breakpoints along the range of

col.regions 
color vector to be used if regions is TRUE. The
general idea is that this should be a color vector of moderately
large length (longer than the number of regions. By default this is
100). It is expected that this vector would be gradually varying in
color (so that nearby colors would be similar). When the colors are
actually chosen, they are chosen to be equally spaced along this
vector. When there are more regions than colors in

alpha.regions 
numeric, specifying alpha transparency (works only on some devices) 
colorkey 
logical specifying whether a color key is to be drawn alongside the plot, or a list describing the color key. The list may contain the following components:

contour 
A logical flag, indicating whether to draw contour lines. 
cuts 
The number of levels the range of 
labels 
Typically a logical indicating whether contour lines should be
labelled, but other possibilities for more sophisticated control
exists. Details are documented in the help page for

pretty 
A logical flag, indicating whether to use pretty cut locations and labels. 
region 
A logical flag, indicating whether regions between contour lines should be filled as in a level plot. 
allow.multiple, outer, prepanel, scales, strip, groups, xlab,
xlim, ylab, ylim, drop.unused.levels, lattice.options,
default.scales, subset 
These arguments are described in the help page for

default.prepanel 
Fallback prepanel function. See 
... 
Further arguments may be supplied. Some are processed by

useRaster 
A logical flag indicating whether raster representations should be
used, both for the false color image and the color key (if present).
Effectively, setting this to Note that Not all devices support raster images. For devices that appear to
lack support, 
These and all other high level Trellis functions have several
arguments in common. These are extensively documented only in the
help page for xyplot
, which should be consulted to learn more
detailed usage.
Other useful arguments are mentioned in the help page for the default
panel function panel.levelplot
(these are formally
arguments to the panel function, but can be specified in the high
level calls directly).
An object of class "trellis"
. The
update
method can be used to
update components of the object and the
print
method (usually called by
default) will plot it on an appropriate plotting device.
Deepayan Sarkar Deepayan.Sarkar@Rproject.org
Sarkar, Deepayan (2008) Lattice: Multivariate Data Visualization with R, Springer. http://lmdvr.rforge.rproject.org/
xyplot
, Lattice
,
panel.levelplot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30  x < seq(pi/4, 5 * pi, length.out = 100)
y < seq(pi/4, 5 * pi, length.out = 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)
## triangular endpoints in color key
levelplot(z ~ x * y, grid, col.regions = topo.colors(10),
at = c(Inf, seq(0.8, 0.8, by = 0.2), Inf))
#SPLUS example
require(stats)
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.out = 50)
t.marginal < seq(min(temperature), max(temperature), length.out = 50)
r.marginal < seq(min(radiation), max(radiation), length.out = 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()

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.