contourPlot: Contour Plot

View source: R/contourPlot.R

contourPlotR Documentation

Contour Plot

Description

Produces a contour plot or a colored surface with colors corresponding to values in z.

Usage

contourPlot(z, ...)

## Default S3 method:
contourPlot(z, x, y, Grid = list(method =
  "interpolate", linear = TRUE, extrapolate = FALSE, density = 90, span =
  0.75, degree = 1, family = "symmetric"), Contours = list(name = "Auto",
  levels = 10, filled = FALSE, lineColor = "black", lineLabel = "flattest",
  fillColors = "coolWarm"), yaxis.range = c(NA, NA),
  xaxis.range = c(NA, NA), ylabels = 4, xlabels = 4,
  xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)),
  caption = "", margin = c(NA, NA, NA, NA), ...)

## S3 method for class 'matrix'
contourPlot(z, rows, cols, matrix.rows = "x",
  Contours = list(name = "Auto", levels = 10, filled = FALSE, lineColor =
  "black", lineLabel = "flattest", fillColors = "coolWarm"),
  yaxis.range = c(NA, NA), xaxis.range = c(NA, NA), ylabels = 4,
  xlabels = 4, xtitle = deparse(substitute(x)),
  ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA,
  NA, NA), ...)

Arguments

z

the values representing the surface data.

...

not used, required for other methods.

x

the x-axis coordinates for each value in z.

y

the y-axis coordinates for each value in z.

Grid

control parameters for gridding irregularly spaced data. See Details.

Contours

control parameters for the coutour lines or levels in the filled plot. See Details.

yaxis.range

set the range of the y-axis.

xaxis.range

set the range of the x-axis.

ylabels

set up y-axis labels. See linearPretty for details.

xlabels

set up x-axis labels. See linearPretty for details.

xtitle

the x-axis title (also called x-axis caption).

ytitle

the y-axis title (also called y-axis caption).

caption

the figure caption.

margin

set the plot area margins, in units of lines of text. Generally all NA or the output from setGraph if appropriate.

rows

the coordinates for z represented by the rows in the matrix.

cols

the coordinates for z represented by the columns in the matrix.

matrix.rows

a single character, either "x" or "y" indicating whether the rows in z should be plotted along the x or y axis.

Details

Missing values are permitted in z, x, and y for the default method and are removed, with a warning. before constructing the surface. Duplicated values, identical x and y, are not permitted and generate an error.

Missing values are not permitted in rows or columns but are permitted in z for the matrix method. Missing values in z result in blank areas in the plot.

The Grid argument must be a tagged list with these components:

method

The method to use for constructung the grid. Must be either "interpolate" or "loess." If "interpolate," then the z values are interpolated directly from the x and y values. If "loess," then the z values are smoothed prior to interpolation

linear

Logical, if TRUE, then use linear interpolation, if FALSE, then use spline interpolation.

extrapolate

Logical, if TRUE, then extrapolate to the limits of the grid, if FALSE, then do not extrapoalte outsite of the hull of the data values.

density

The density of the grid—the number of cells along x and y.

span

The span argument for loess if method is "loess."

degree

The degree argument for loess if method is "loess."

family

The family argument for loess if method is "loess."

#'The Contour argument must be a tagged list with these components:

name

The name to use to describe the contours. If "Auto" and filled is TRUE, then the descripotion is blank. If "Auto" and filled is FALSE, the the description is Line of equal value." In all other cases, the description is the text assigned to name.

levels

Either the number of levels of contours or a vector of the desired contour levels.

filled

Logical, if TRUE, then draw filled contours, if FALSE, then only contour lines are drawn.

lineColor

The color to draw the contour lines. Can be set to "none" to supress drawing lines for filled contours.

lineLabel

A character string indicating how to draw the labels on the contours. May be "none" to supress draing the labels, or any valid value for the method argument to contour.

fillColors

The prefix corresponding to a color ramp generating function, like "warmCool" for the warmCool.colors function.

Value

Information about the graph.

Examples

## Not run: 
set.seed(1)
Xbig <- runif(100)
Ybig <- runif(100)
# Make a hill
Zbig <- 1 - ((Xbig-.5)^2 + (Ybig-.5)^2)^.75
setGD()
contourPlot(Zbig, Xbig, Ybig)
# See for examples of contourPlot see
vignette(topic="GraphGallery", package="smwrGraphs")

## End(Not run)

USGS-R/smwrGraphs documentation built on Oct. 11, 2022, 6:11 a.m.