On Thu, Jul 24, 2008 at 2:23 AM, Williams Scott <[EMAIL PROTECTED]> wrote: > I am trying to do something simple with ggplot. I wish to draw a density > plot split by group, and fill each group with a different colour (and > each with an alpha =0.25). I have tried a number of variations of the > following, but cannot find a way to define the colour of the fill, its > transparency and the line around it individually - something in the > syntax continues to defy me.
To fill each density with a different colour you want: + geom_density(aes(fill=group)) I'm not sure what you want to do with the line, but I'm going to guess you want to make it transparent: + geom_density(aes(fill=group), colour = NA) The slightly tricky thing is then making these colours transparent - it's the scale that's responsible for converting data values into shades of colour, so you'll need to change options there: + scale_fill_hue(alpha = 0.25) Does that help? Hadley -- http://had.co.nz/ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.