[R] ggplot2: specifying legend titles

Etches Jacob jetches at iwh.on.ca
Fri Mar 20 15:07:29 CET 2009

I am trying to specify a legend title to be other than the variable  
name, but I find that the legend splits because scale_shape() takes  
effect but scale_colour() does not.  Can someone spot my error?   
Here's some toy code that produces the problem on my system (R2.8.1,  
windows, today's CRAN package updates):

a <- sample(letters[1:5],100,replace=T)
b <- rnorm(100)
c <- rnorm(100)
qplot(b,c,shape=a,colour=a) +
   scale_colour("Better legend title") +
   scale_shape("Better legend title")

Any review or distribution by anyone other than the person for whom it was originally intended is prohibited.
If you have received this e-mail in error please delete all copies.
Opinions conclusions or other information contained in this e-mail may not be that of the organization.

More information about the R-help mailing list