dgridplot {BMAmevt}R Documentation

Image and/or Contour plots of spectral densities in trivariate extreme value models

Description

Plots contours or gray-scale level sets of a spectral density on the two-dimensional simplex.

Usage

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",
  ...
)

Arguments

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)

[Package BMAmevt version 1.0.5 Index]