Learn R Programming

RSurvey (version 0.8-3)

Plot2d: Plot Points or Interpolated Surface

Description

Draws a scatter plot or contour plot with arrows. A key showing how the colors map to state variable values is shown to the right of the plot.

Usage

Plot2d(x = NULL, y = NULL, z = NULL, vx = NULL, vy = NULL, type = "p", xlim = NULL, ylim = NULL, zlim = NULL, xlab = NULL, ylab = NULL, zlab = NULL, asp = NA, csi = NA, width = 7, pointsize = 12, cex.pts = 1, nlevels = 20, rkey = FALSE, color.palette = terrain.colors, vuni = FALSE, vmax = NULL, vxby = NULL, vyby = NULL, axis.side = 1:2, minor.ticks = FALSE, ticks.inside = FALSE, add.contour.lines = FALSE, rm.pnt.line = FALSE)

Arguments

x
numeric; a vector of x coordinates for the plot. If x is a data frame, its components x$x, x$y, x$z, x$vx, and x$vy are used for x, y, z, vx, and vy, respectively.
y
numeric; a vector of y coordinates for the plot.
z
numeric or matrix; the state variable values to be plotted, NAs allowed. A matrix is required for contour plots.
vx, vy
numeric; a vector of arrow component lengths in the x and y directions.
type
character; a 1-character string giving the type of plot desired. The following values are possible: "p" for points, "l" for level contour, "g" for grid contour.
xlim
numeric; a vector of x limits (x1,x2) for the plot.
ylim
numeric; a vector of y limits (y1,y2) for the plot.
zlim
numeric; a vector of z limits (z1,z2) for the plot.
xlab, ylab
character; the label for the x and y axis.
zlab
character; the label for the z legend.
asp
numeric; the y/x aspect ratio.
csi
numeric; height of text characters in inches.
width
numeric; the width of the plotting window canvas in inches.
pointsize
integer; the point size of plotted text.
cex.pts
numeric; the amount by which point symbols should be magnified relative to the default.
nlevels
integer; number of contour levels desired.
rkey
logical; if TRUE the legend key is reversed with z values descending from top to bottom; its default is FALSE.
color.palette
function; a color palette to be used to assign colors in the plot.
vuni
logical; if TRUE all arrow lengths are set equal; its default is FALSE.
vmax
numeric; the maximum length of arrows in inches.
vxby, vyby
integer; increment for the sequence of arrows in the x and y direction.
axis.side
integer; the side of the plot the axis is to be drawn on. The axis is placed as follows: 1 = below, 2 = left, 3 = above and 4 = right.
minor.ticks
logical; if TRUE minor tickmarks are added to the plot; its default is FALSE.
ticks.inside
logical; if TRUE tickmarks are placed inside the plot region; its default is FALSE.
add.contour.lines
logical; if TRUE and type is either "l" or "g" than contour lines are drawn; its default is FALSE.
rm.pnt.line
logical; if TRUE the line boundary on point symbols is not drawn; its default is FALSE.

Details

The length of x and y should be equal to the nrow(z) and ncol(z), respectively.

See Also

filled.contour, image, arrows, AddAxis

Examples

Run this code
data(ex.project)

d <- ex.project$data.pts
Plot2d(d, type = "p")

d <- ex.project$data.grd
Plot2d(d, type = "l")
Plot2d(d, type = "g")

Run the code above in your browser using DataLab