3

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.

Frank Harrell
  • 1,954
  • 2
  • 18
  • 36
  • 2
    See http://stackoverflow.com/questions/37487475/ggplot2-count-not-working-with-stat-bin-hex-anymore#comment62476216_37487475 – lukeA Jun 17 '16 at 20:40

0 Answers0