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 colour=factor(dat[,2])
use scale_fill_hue(name = "Pallet", labels = c("X", "Y")) instead.
Regards,
Paul
RON70 wrote:
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
______________________________________________
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.