hhh4contacts (version 0.13.1)

plotC: Generate an Image of a Contact Matrix

Description

Generate an Image of a Contact Matrix

Usage

plotC(
  C,
  grouping = NULL,
  xlab = "age group of contact",
  ylab = "age group of participant",
  at = 15,
  col.regions = rev(heat.colors(length(at) - 1)),
  ...,
  contour = FALSE
)

Arguments

C

a square numeric matrix.

grouping

numeric vector of sizes of aggregated groups, e.g., grouping = c(1,3), to draw separation lines after the first and the forth subgroup. This is ignored if contour = TRUE.

xlab, ylab

axis labels.

at

numeric vector of break points of the color levels, or a single integer specifying the number of cuts (which defaults to 15 as in levelplot).

col.regions

vector of color levels.

...

further arguments passed to levelplot or filled.contour (if contour = TRUE).

contour

logical indicating if a filled.contour should be drawn instead of a levelplot (the default).

Examples

Run this code
## contour plot
plotC(contactmatrix_POLYMOD, contour = TRUE)

## level plots illustrating aggregation of age groups
if (require("gridExtra")) {
    grid.arrange(plotC(contactmatrix_POLYMOD, grouping = c(1,2,2,4,4,2)),
                 plotC(contactmatrix(grouping = c(1,2,2,4,4,2))),
                 nrow = 1)
}

Run the code above in your browser using DataLab