Adding a background image to a levelplot
问题 I'd like to make a levelplot which has a background image. The following code promts the error message Error in rasterImage(image, x[1], y[1], x[length(x)], y[length(y)]) : plot.new has not been called yet - apparently rasterImage does not recognize printed levelplot object as a plot. What's the appropriate method instead of rasterImage ? library("png") library("lattice") library("latticeExtra") MyFunction <- function(x,y){ return( dnorm(sqrt(x^2+y^2)) ) } meshstep <- 0.2 x<- seq(-20,20