[R] ggplot2: expression() in legend labels?
Dennis Murphy
djmuser at gmail.com
Tue Oct 4 18:08:09 CEST 2011
Hi:
Here's a reproducible example:
d <- data.frame(grp = factor(rep(c('x', 'y'), each = 5)),
ev = rnorm(10), dv = rnorm(10))
labl <- list(expression(italic('x')), expression(italic('y')))
ggplot(d, aes(x = ev, y = dv, shape = grp)) + geom_point() +
scale_shape_manual('Group', breaks = levels(d$grp),
values = 1:2,
labels = labl)
HTH,
Dennis
On Tue, Oct 4, 2011 at 8:59 AM, Casper Ti. Vector
<caspervector at gmail.com> wrote:
> Hmm, that's my fault when composing this mail, but the problem was
> really encountered at that time.
> Nevertheless, neither can I reproduce the problem now, perhaps I just
> made another mistake at that time.
> Thanks all the same, and sorry for the disturbance anyway :|
>
> On Tue, Oct 04, 2011 at 10:10:56AM -0500, Hadley Wickham wrote:
>> You need to set the labels...
>
> --
> Using GPG/PGP? Please get my current public key (ID: 0xAEF6A134,
> valid from 2010 to 2013) from a key server.
>
>
> ______________________________________________
> 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.
>
>
More information about the R-help
mailing list