hadley/ggplot2 — Issue #316: stat_contour not working on irregular datasets
Author: ThierryO
Created: 2011-12-22 09:00:48+00:00
State: open

#a nice grid and it works
library(ggplot2)
set.seed(12345)
tmp <- expand.grid(POINT_X = 0:35, POINT_Y = 0:16)
tmp$Estimate <- runif(nrow(tmp))
ggplot(tmp, aes(x = POINT_X, y = POINT_Y, z = Estimate)) + stat_contour()

#adding a tiny bit of noise on the coordinates gives problems
tmp$POINT_X <- tmp$POINT_X + rnorm(nrow(tmp), sd = 0.0001)
tmp$POINT_Y <- tmp$POINT_Y + rnorm(nrow(tmp), sd = 0.0001)
ggplot(tmp, aes(x = POINT_X, y = POINT_Y, z = Estimate)) + stat_contour()