[R] ggplot2: specifying legend titles
hadley wickham
h.wickham at gmail.com
Fri Mar 20 15:38:17 CET 2009
On Fri, Mar 20, 2009 at 9:07 AM, Etches Jacob <jetches at iwh.on.ca> wrote:
> 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")
I'm not sure where scale_colour is coming from - you want
scale_colour_discrete()
Hadley
> 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.
>
> ______________________________________________
> R-help at 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.
>
--
http://had.co.nz/
More information about the R-help
mailing list