[R] Density plot in ggplot2

2009-07-28 Thread RON70
Hi all, I was trying to draw a stacked density plot like that : library(ggplot2); library(plyr) dat - cbind(rnorm(300), rep(c(1,2), each=150)) ggplot() + geom_density(aes(x=dat[,1], fill=factor(dat[,2]), position=stack)) + xlab() + ylab() + scale_colour_manual(name = Pallet,

Re: [R] Density plot in ggplot2

2009-07-28 Thread Paul Emberson
Hi Ron, I'm not sure why ylab doesn't work. Maybe a bug. I note the label doesn't get removed with labs() either. However using scale_y_continuous(name=) does remove the label. For the legend, you are using a fill scale, not a colour scale i.e. fill=factor(dat[,2]), not

Re: [R] Density plot in ggplot2

2009-07-28 Thread Matthieu Dubois
Hi, small modifications to your code will do the trick Here everything is ok, except few points : 1. I want to remove the name of y-axis, which is by default density. Here I put ylab(), however although for x-axis it is working, for y-axis it is not. Is there any specific formula for that?