In R 2.13.1 / ggplot2 0.8.9, I'm trying to add points onto a geom_tile layer. This example reproduces the error.
volcano3d <- melt(volcano)
names(volcano3d) <- c("x", "y", "z")
pts <- data.frame(a=runif(10,0,80), b=runif(10,0,60))
v <- ggplot(volcano3d, aes(x, y, z = z))
v + geom_tile(aes(fill = z))
# works fine
v + geom_tile(aes(fill = z)) + geom_point(data=pts, aes(x=a, y=b))
# Error in eval(expr, envir, enclos) : object 'z' not found
Any idea on what is wrong?