Skip to content
Prev 245928 / 398503 Next

levelplot blocks size

Here is a basic example: 

tmp.df <- expand.grid( x= 1:100, y=1:100 )
tmp.df$z <- with(tmp.df, x+2*y)

library(lattice)
levelplot( z ~ x + y, data=tmp.df )

tx2 <- with(tmp.df, cut(x, seq(0.5, 100.5, 10) ) )
ty2 <- with(tmp.df, cut(y, seq(0.5, 100.5, 20) ) )

tmp.df2 <- aggregate(tmp.df, list( tx2, ty2 ), mean )

levelplot( z ~ x + y, data=tmp.df2 )


Hope this helps,