Prior to version 2 the following worked:
require(ggplot2)
set.seed(1)
x <- runif(100)
y <- runif(100)
count <- sample(1:100, 100, TRUE)
x <- rep(x, count)
y <- rep(y, count)
d <- data.frame(x,y)
ggplot(d, aes(x=x, y=y)) + stat_binhex(aes(alpha=..count.., color=cut(..count.., c(30, 50, 70))), bins=20) +
guides(alpha=FALSE, fill=FALSE, color=guide_legend(title='Frequency'))
Now I get:
Error in eval(expr, envir, enclos) : object 'count' not found
I've played around with geom_hex
but with no success. Does anyone know how to modify the above code to work with the latest version? I would like to be able to use geom_hex
but would also be happy getting stat_binhex
to work.