contourLinesR {contoureR}R Documentation

Get Contour Lines (list)

Description

A wrapper to the getContourLines function, provided to ease the transition from the contourLines function as part of grDevices

Usage

contourLinesR(x, y, z, nlevels = 10, levels = pretty(range(z, na.rm =
  TRUE)), ...)

Arguments

x

Numeric data for x and y coordinate, a single matrix or data-frame object can be provided for x, which will be used in preference to the y and z arguments. These do NOT need to be in any particular order nor do they need to be regular.

y

Numeric data for x and y coordinate, a single matrix or data-frame object can be provided for x, which will be used in preference to the y and z arguments. These do NOT need to be in any particular order nor do they need to be regular.

z

numeric Data for z coordinate (the coordinate to model)

nlevels

An integer number of bins to split the data into iff levels or binwidth have not been specified.

levels

A numeric vector of the explicitly specified levels (z values) to contour, by specifying this argument, it will override nlevels and/or binwidth. If this argument is provided, the stacking order of the contours will be preserved in the order of first occurence within the supplied vector.

...

any other parameters passed through to getContourLines

Details

This function returns data in the same format/structure as contourLines, ie, list of lists, which is different from the (preferred) dataframe object returned by the getContourLines function as part of the present work.

Value

A list of contours is returned, Each contour is a list with the elements:

level

The contour of the level

x

The x-coordinates of the contour

y

The y-coordinates of the contour

See Also

getContourLines

Examples

library(contoureR)
library(ggplot2)
x = runif(100)
y = runif(100)
df = expand.grid(x=x,y=y)
z  = with(df,x+y)
result = contourLinesR(df$x,df$y,z)

[Package contoureR version 1.0.5 Index]