Produce a Contour Plot or Level Plot

USAGE:

contourplot(formula, at, col.regions, colorkey = region, 
            contour = TRUE, cuts = 7, labels = format(at), 
            pretty = TRUE, region = FALSE, ...) 
levelplot(formula, at, col.regions = , colorkey = region, 
          contour = FALSE, cuts = 15, labels = format(at), 
          pretty = FALSE, region = TRUE, ...) 

The levelplot and contourplot functions are done by common code and differ only in the default settings of the listed arguments.
The following arguments have special meaning within these functions. The common meanings for these and all other arguments are listed separately under trellis.args.

ARGUMENTS:

formula
a formula, in general, its form is: z ~ x * y | g1 * g2 * ... The z variable is a numeric response, and x and y are the numeric predictors evaluated on a rectangular grid. The given variables g1, g2 , ... may be omitted.
at
values of z for the contour lines or breaks between colored regions. If at is omitted, it is computed based on the pretty flag: if pretty is TRUE, the default for at is pretty(z,cuts) ; if pretty is FALSE, the default is seq(min(z),max(z),length=cuts+2) .
col.regions
numeric vector of color numbers used to color the regions between contour lines.
colorkey
a logical flag or a list of arguments to be passed to the color.key function. If colorkey is TRUE, a color key is placed in the right margin on each page; if FALSE, no color key will be displayed. By default, a color key is displayed if regions are colored, i.e., there is a color key on a level plot but not on a contour plot. If colorkey is a list with a component named space, space for the color key will be reserved on the appropriate side of the array of panels; values for space are "top", "bottom", "left" , and "right" . See the documentation for color.key for a full description of the other components of the colorkey= list.
contour
logical flag. If contour is TRUE, a set of labeled contour lines will be drawn on the plot at the z-values of at.
cuts
determines the number of levels the range of z will be divided into for generating the at vector. See the description of at for details of how its default values are generated from cuts and pretty.
labels
a logical flag, a character vector of contour labels or a list that contains a character vector along with graphical parameter vectors to control size, color, and font of the labels. If labels is FALSE, no labels are drawn on the contour lines. Labels are drawn only if contour is TRUE.
pretty
logical, should the generated at vector be made up of pretty numbers (useful when labeling contours)?
region
logical flag; if FALSE, the regions between the contour lines will not be colored.

VALUE:

an object of class trellis, which is automatically plotted by print.trellis.

SEE ALSO:

, , , .

EXAMPLES:

# level plot with contours 
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)) 
levelplot(fit ~ wind * temperature | radiation, data = grid, 
          contour = T, region = T,  
          xlab = "Wind Speed (mph)", ylab = "Temperature (F)", 
          main = "Cube Root Ozone (cube root ppb)")