View source: R/levelplotPanels.R
lpi | R Documentation |
These panel functions work in conjunction with levelplot
and label the cells of the plot with text. lpi
labels with integers and lpr
labels with real
numeric (real) values.
lpi(x, y, z, ...)
x |
Numeric or integer vector, as in levelplot. |
y |
Numeric or integer vector, as in levelplot. |
z |
Numeric or integer vector, as in levelplot. |
... |
Additional parameters to be passed to levelplot. |
None. A level plot is displayed.
require('lattice') # ### Numeric test data # M1 <- abs(matrix(runif(16, 0.2, 1), nrow = 4)) rownames(M1) <- as.character(1:4) colnames(M1) <- as.character(1:4) # Negate the lower triangle values M1[lower.tri(M1)] <- -1.0*M1[lower.tri(M1)] diag(M1) <- 0.0 M2 <- t(M1[nrow(M1):1,]) levelplot(M2, xlab.top = "column", ylab = "row", xlab = "", scale = list(x = list(alternating = 2)), col.regions = cm.colors(3), at = c(-1.0, -0.01, 0.01, 1.0), panel = lpr) # ### Integer test data # M3 <- matrix(1:16, ncol = 4, byrow = TRUE) rownames(M3) <- as.character(1:4) colnames(M3) <- as.character(1:4) M4 <- t(M3[nrow(M3):1,]) levelplot(M4, xlab.top = "column", ylab = "row", xlab = "", scale = list(x = list(alternating = 2)), col.regions = heat.colors(26), panel = lpi)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.