density: A npoints*npoints matrix containing the density's values scattered on the discretization grid defined by npoints, equi, eps (see discretize).
eps: Positive number: minimum distance from any node inside the simplex to the simplex boundary
equi: logical. Is the simplex represented as an equilateral triangle (if TRUE) or a right triangle (if FALSE) ?
add: Logical. Should the contours be added to a currently active plot ?
breaks: Set of breakpoints for the gray scale colors. See image
levels: Levels to which plot the contour lines. See contour
col.lines: The color to be used for the contour lines.
labcex: cex for contour labeling. See contour.
background: Logical. Should a the background be filled inside the simplex via a call to image ?
col.polygon: The background color outside the simplex.
lab1: Character string: label for first component.
lab2: Character string: label for second component.
lab3: Character string: label for third component.
...: Additional graphical parameters and arguments to be passed to contour and image.
Details
The function interprets the density matrix as contour does, i.e. as a table of f(X[i], Y[j]) values, with column 1 at the bottom, where X and Y are returned by discretize and f is the density function.
Examples
wrapper <-function(x, y, my.fun,...){ sapply(seq_along(x), FUN =function(i) my.fun(x[i], y[i],...))}grid <- discretize(npoints=40,eps=1e-3,equi=FALSE)Density <- outer(grid$X,grid$Y,FUN=wrapper, my.fun=function(x,y){10*((x/2)^2+y^2)*((x+y)<1)})dgridplot(density= Density,npoints=40, equi=FALSE)