Learn R Programming

plotfunctions (version 1.4)

plot_signifArea: Creates a colored surface plot from data frame input.

Description

This function uses rasterImage to indicate which points in the surface are not significantly different from zero. Note that the shape of these non-significant regions depends on the number of data points (often specified with n.grid).

Usage

plot_signifArea(data, view, predictor = NULL, valCI, col = 1, alpha = 0.5, ...)

Arguments

data

Data frame with plot data. A data frame needs to have a column with x values, a column with y values (specified in view), a column with z values (predictor), and one or two columns with CI values (valCI).

view

A vector of length 2 with the names or numbers of the columns to plot on the x axis and y axis respectively.

predictor

The name of the column in the data frame data that provides the z-values. If data contains more than one column besides the x- and y-values, the predictor should be provided.

valCI

The name of the column in the data frame data that provides the CI-values. Alternatively, two column names can be provided for the lower and upper CI respectively.

col

Color for the nonsignificant areas.

alpha

Level of transparency, number between 0 (transparent) and 1 (no transparency)

...

Optional parameters for rasterImage

See Also

rasterImage

Examples

Run this code
# NOT RUN {
# From the package graphics, see help(image):
x <- 10*(1:nrow(volcano))
y <- 10*(1:ncol(volcano))
tmp <- data.frame(value = (as.vector(volcano) - 120), 
    x = 10*rep(1:nrow(volcano), ncol(volcano)), 
    y = 10*rep(1:ncol(volcano), each=nrow(volcano)),
    CI = rep(20, nrow(volcano)*ncol(volcano)))
plotsurface(tmp, view=c('x', 'y'), predictor='value', main='Maunga Whau Volcano')
plot_signifArea(tmp, view=c('x', 'y'), predictor='value', valCI='CI')

# change color:
plotsurface(tmp, view=c('x', 'y'), predictor='value', main='Maunga Whau Volcano')
plot_signifArea(tmp, view=c('x', 'y'), predictor='value', valCI='CI', 
    col='red')
# or completely remove 'nonsignificant' area:
plot_signifArea(tmp, view=c('x', 'y'), predictor='value', valCI='CI', 
    col='white', alpha=1)

# }

Run the code above in your browser using DataLab