Skip to content

ggplot2: specifying legend titles

2 messages · Jacob Etches, Hadley Wickham

#
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):

library(ggplot2)
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.
#
On Fri, Mar 20, 2009 at 9:07 AM, Etches Jacob <jetches at iwh.on.ca> wrote:
I'm not sure where scale_colour is coming from - you want
scale_colour_discrete()

Hadley