dgridplot {BMAmevt} | R Documentation |
Plots contours or gray-scale level sets of a spectral density on the two-dimensional simplex.
dgridplot(density = matrix(5 * sin(1/73 * (1:(40 * 40)))^2, ncol = 40, nrow = 40), eps = 10^(-3), equi = TRUE, add = FALSE, breaks = seq(-0.01, 5.1, length.out = 1000), levels = seq(0, 6, length.out = 13), col.lines = "black", labcex = 0.8, background = FALSE, col.polygon = gray(0.5), lab1 = "w1", lab2 = "w2", lab3 = "w3", ...)
density |
A |
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 |
add |
Logical. Should the contours be added to a currently active plot ? |
breaks |
Set of breakpoints for the gray scale colors.
See |
levels |
Levels to which plot the contour lines. See |
col.lines |
The color to be used for the contour lines. |
labcex |
|
background |
Logical. Should a the background be filled
inside the simplex via a call to
|
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 |
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.
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)