[R] Legend
Frede Aakmann Tøgersen
FredeA.Togersen at agrsci.dk
Wed Sep 26 11:49:13 CEST 2007
You can use bquote (see ?bquote or the example in ?plotmath using bquote).
Here you go,
pvalue <- 0.3
legend("bottom", fill=c("red","blue"), legend=c(bquote(p==.(pvalue)), expression(p==0.50)), bty="n")
Med venlig hilsen
Frede Aakmann Tøgersen
> -----Oprindelig meddelelse-----
> Fra: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] På vegne af stat stat
> Sendt: 26. september 2007 00:13
> Til: r-help at stat.math.ethz.ch
> Emne: [R] Legend
>
> I have following syntax for putting a legend :
>
> legend("bottom", fill=c("red","blue"),
> legend=expression(p==0.30, p==0.50), bty="n")
>
> However what I want is that : the value "0.30" should be a
> value of a variable instead of a constant, so that I can put
> the name of this variable and in legend it's value will be
> displayed. Can anyone tell me how to do that?
>
> Regards,
>
>
> thanks in advance
>
> ---------------------------------
> Why delete messages? Unlimited storage is just a click away.
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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