On Tue, Jan 29, 2013 at 7:20 AM, Ben Bond-Lamberty <
bpb...@gmail.com> wrote:
> The error message tells exactly what the problem is--you can't vary an
> aesthetic (here line width) over a line; for the same reason, a line
> can't change color as it goes. You'll need to find another way to plot
> this information.
That's not what the error says, nor is it true:
library(plyr) # to access round_any
movies$decade <- round_any(movies$year, 10)
m <- ggplot(movies, aes(x=rating))
m + stat_density(aes(color = ..count..), geom="line")
The error says aesthetics can't vary within a ribbon, but there is no
reason the density has to be plotted with a ribbon goem.
Best,
Ista