Level (Contour) Plots

Usage

filled.contour(x = seq(0, 1, len = nrow(z)),
               y = seq(0, 1, len = ncol(z)),
               z, xlim = range(x[is.finite(x)]),
               ylim = range(y[is.finite(y)]),
               zlim = range(z[is.finite(z)]),
               levels = pretty(zlim, nlevels), nlevels = 20,
               color.palette = cm.colors,
               col = color.palette(length(levels) - 1),
               plot.title, plot.axes, key.title, key.axes,
               xaxs="i", yaxs="i", las=1, axes=TRUE, ...)

Arguments

x,y locations of grid lines at which the values in z are measured. These must be in ascending order. By default, equally spaced values from 0 to 1 are used. If x is a list, its components x$x and x$y are used for x and y, respectively. If the list has component z this is used for z.
z a matrix containing the values to be plotted (NAs are allowed). Note that x can be used instead of z for convenience.
xlim x limits for the plot.
ylim y limits for the plot.
zlim z limits for the plot.
levels a set of levels which are used to partition the range of z. Areas with z values between consecutive levels are painted with the same color.
nlevels if levels is not specified, the range of z, values is divided into approximately this many levels.
color.palette a color palette function to be used to assign colors in the plot.
col an explicit set of colors to be used in the plot. This argument overrides any palette function specification.
plot.title statements which add titles the main plot.
plot.axes statements which draw axes on the main plot. This overrides the default axes.
key.title statements which add titles for the plot key.
key.axes statements which draw axes on the plot key. This overrides the default axis.
xaxs the x axis style. The default is to use internal labeling.
yaxs the y axis style. The default is to use internal labeling.
las the style of labeling to be used. The default is to use horizontal labeling.
... additional graphical parameters.

Description

This function produces a contour plot with the areas between the contours filled in solid color (Cleveland calls this a level plot). A key showing how the colors map to z values is shown to the right of the plot.

Note

This function currently uses the layout function and so is restricted to a full page display. In future it is likely to be replaced by a genuine levelplot function which will work in multipanel displays.

Author(s)

Ross Ihaka.

References

Cleveland, W. S. (1993). Visualizing Data, Summit, New Jersey: Hobart.

See Also

contour, palette.

Examples

data(volcano)
x <- 10*1:nrow(volcano)
y <- 10*1:ncol(volcano)

filled.contour(x, y, volcano, color = terrain.colors, nlevels = 20,
    plot.title = title(main = "The Topography of Maunga Whau",
    xlab = "Meters North", ylab = "Meters West"),
    plot.axes = { axis(1, seq(100, 800, by = 100))
                  axis(2, seq(100, 600, by = 100)) },
    key.title = title(main="Height (Meters)"),
    key.axes = axis(4, seq(90, 190, by = 10)))


[Package Contents]