Dear all,
This is is my first post on this list. I'm studying ggplot2 with the book, and I'm stuck with an error with the code on page 61 :
# Three variations on the histogram. (Left) A frequency polygon;
# (middle) a scatterplot with both size and height mapped to frequency;
# (right) a heatmap representing frequency with colour.
d <- ggplot(diamonds, aes(carat)) + xlim(0, 3)
d + stat_bin(aes(ymax = ..count..), binwidth = 0.1, geom = "area")
d + stat_bin(aes(size = ..density..), binwidth = 0.1, geom = "point", position="identity")
d + stat_bin(aes(y=1, fill = ..count..), binwidth = 0.1, geom = "tile", position="identity") + scale_y_continuous("")
The last chart doesn't work? I get the following error : "stat_bin() must not be used with a y aesthetic".
I suppose ggplot2 has changed a bit since the book was published 7 years ago. I'm using ggplot2 2.1.0.
Thanks in advance for your help.