twPlot2D: twPlot2D

Description Usage Arguments Author(s) See Also Examples

View source: R/plotTwMisc.R

Description

Creating an image or contour plot of a three-dimensional array.

Usage

1
2
3
4
twPlot2D(x, y = NULL, z = NULL, xlab = NULL, ylab = NULL, 
    zlab = NULL, key.title, key.axes, axes = TRUE, 
    las = 1, contour = FALSE, col = rev(heat.colors(20)), 
    ...)

Arguments

x

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.

y
z

a matrix containing the values to be plotted (NAs are allowed). Note that x can be used instead of z for convenience.

xlab

labels, default to variable names or column names in x

ylab
zlab
key.title

see filled.contour

key.axes
axes
las
contour

if TRUE then filled.contour is used for plotting. Otherwisee image

col

colors for using image

...

further arguments passed to filled.contour or image # such as key.title=title(sub="Log-Like-\nlihood\n"), color.palette=function(n){rev(heat.colors(n))} # or for image col=rev(heat.colors(20))

Author(s)

Thomas Wutzler

See Also

twPairs, twMisc

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
    nmix3 <- function(x, y, m, s) {
        0.4 * dnorm(x, m, s) * dnorm(y, m, s)  +
            0.3 * dnorm(x, -m, s) * dnorm(y, -m, s)  +
            0.3 * dnorm(x, m, s) * dnorm(y, -1.5 * m, s) 
    }
    f <- function(x,y) nmix3(x,y,.5,.5)
    
    n <- 30
    x <- sort(rnorm(n,.5,.7))
    y <- sort(rnorm(n,.5,.8))
#mtrace(twApply2DMesh)
#mtrace(twPlot2DFun)
    tmp <- twApply2DMesh(x,y,f,knotSpacing="all")
    #plot(tmp)
    twPlot2D( tmp$mesh,z=tmp$fval,zlab="density")
    

twMisc documentation built on May 2, 2019, 6:11 p.m.