mat <- read.csv("J_H2S1T6_PassTraffic.csv", header=F) y <- as.numeric(mat[1,-1]) mat <- mat[-1,-1] n <- dim(mat)[1]
Here's a modification, I'm creating a new scale
x <- seq(min(y), max(y), length.out=n) grid <- expand.grid(x=x, y=x) mat <- as.matrix(mat) dim(mat) <- c(n*n,1) grid$z <- mat
Here is a modification. I change the dimension of the matrix to a vector to fit it into the grid.
mat <- as.matrix(mat) dim(mat) <- c(n*n,1) grid$z <- mat p <- levelplot(z~x*y, grid, panel=function(...) { arg <- list(...) panel.levelplot(...) panel.text(arg$x, arg$y,arg$z)}, scales = list(y = list(at=y,labels=y), x = list(at=y,labels=y))) print(p)

agstudy
source share