[R] Density plot in ggplot2

RON70 ron_michael70 at yahoo.com
Tue Jul 28 18:15:21 CEST 2009


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", labels = c("X", "Y"))

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?

2. I want to rename the color plot, as well as the title of the color. The
function scale_colour_manual() seems not working. Can anyone please suggest
me how to achieve desired thing?

Thanks
-- 
View this message in context: http://www.nabble.com/Density-plot-in-ggplot2-tp24702858p24702858.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list